summaryrefslogtreecommitdiffstats
path: root/googletest/test/googletest-param-test-test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-01-14 05:41:46 (GMT)
committervslashg <gfalcon@google.com>2020-01-16 18:55:45 (GMT)
commit0b024bd91a14a77a7e7d6072ccd88e09c86ddeaa (patch)
tree78c316c82a0281387d5b1959eb6cafcd68848c0b /googletest/test/googletest-param-test-test.cc
parented16134fb31382fd41e8fe513a0e9e940d04cd31 (diff)
downloadgoogletest-0b024bd91a14a77a7e7d6072ccd88e09c86ddeaa.zip
googletest-0b024bd91a14a77a7e7d6072ccd88e09c86ddeaa.tar.gz
googletest-0b024bd91a14a77a7e7d6072ccd88e09c86ddeaa.tar.bz2
Googletest export
Add GTEST_ALLOW_UNINSTANTIATED_PARAMTERIZED_TEST to mark a paramaterized test as allowed to be un-instantiated. This allows test suites, that are defined in libraries and, for other reasons, get linked in (which should probably be avoided, but isn't always possible) to be marked as allowed to go uninstantiated. This can also be used to grandfather existing issues and expedite adoption of the checks with regards to new cases before they can be fixed. PiperOrigin-RevId: 289581573
Diffstat (limited to 'googletest/test/googletest-param-test-test.cc')
-rw-r--r--googletest/test/googletest-param-test-test.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc
index f92eb31..b3b8140 100644
--- a/googletest/test/googletest-param-test-test.cc
+++ b/googletest/test/googletest-param-test-test.cc
@@ -1077,6 +1077,17 @@ class NotUsedTest : public testing::TestWithParam<int> {};
template <typename T>
class NotUsedTypeTest : public testing::Test {};
TYPED_TEST_SUITE_P(NotUsedTypeTest);
+
+// Used but not instantiated, this would fail. but...
+class NotInstantiatedTest : public testing::TestWithParam<int> {};
+// ... we mark is as allowed.
+GTEST_ALLOW_UNINSTANTIATED_PARAMTERIZED_TEST(NotInstantiatedTest);
+
+TEST_P(NotInstantiatedTest, Used) { }
+
+using OtherName = NotInstantiatedTest;
+GTEST_ALLOW_UNINSTANTIATED_PARAMTERIZED_TEST(OtherName);
+TEST_P(OtherName, Used) { }
} // namespace works_here
int main(int argc, char **argv) {