summaryrefslogtreecommitdiffstats
path: root/src/googletest/googlemock/test/gmock-function-mocker_nc_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/googletest/googlemock/test/gmock-function-mocker_nc_test.py
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/googletest/googlemock/test/gmock-function-mocker_nc_test.py')
-rw-r--r--src/googletest/googlemock/test/gmock-function-mocker_nc_test.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/googletest/googlemock/test/gmock-function-mocker_nc_test.py b/src/googletest/googlemock/test/gmock-function-mocker_nc_test.py
new file mode 100644
index 000000000..8ef6e09fa
--- /dev/null
+++ b/src/googletest/googlemock/test/gmock-function-mocker_nc_test.py
@@ -0,0 +1,43 @@
+"""Negative compilation tests for Google Mock macro MOCK_METHOD."""
+
+import os
+import sys
+
+IS_LINUX = os.name == "posix" and os.uname()[0] == "Linux"
+if not IS_LINUX:
+ sys.stderr.write(
+ "WARNING: Negative compilation tests are not supported on this platform")
+ sys.exit(0)
+
+# Suppresses the 'Import not at the top of the file' lint complaint.
+# pylint: disable-msg=C6204
+from google3.testing.pybase import fake_target_util
+from google3.testing.pybase import googletest
+
+# pylint: enable-msg=C6204
+
+
+class GMockMethodNCTest(googletest.TestCase):
+ """Negative compilation tests for MOCK_METHOD."""
+
+ # The class body is intentionally empty. The actual test*() methods
+ # will be defined at run time by a call to
+ # DefineNegativeCompilationTests() later.
+ pass
+
+
+# Defines a list of test specs, where each element is a tuple
+# (test name, list of regexes for matching the compiler errors).
+TEST_SPECS = [
+ ("MOCK_METHOD_INVALID_CONST_SPEC",
+ [r"onst cannot be recognized as a valid specification modifier"]),
+]
+
+# Define a test method in GMockNCTest for each element in TEST_SPECS.
+fake_target_util.DefineNegativeCompilationTests(
+ GMockMethodNCTest,
+ "google3/third_party/googletest/googlemock/test/gmock-function-mocker_nc",
+ "gmock-function-mocker_nc.o", TEST_SPECS)
+
+if __name__ == "__main__":
+ googletest.main()