aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/test
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-01-16 14:58:28 -0500
committerXiaoyi Zhang <zhangxy@google.com>2020-01-21 16:26:08 -0500
commit18b67bfc58b1c5657198e5d7e5cc9a99049b154e (patch)
tree9f5554aeb77e4dfae8d697b4714d9f0f84eff903 /googletest/test
parent8b4817e3df3746a20502a84580f661ac448821be (diff)
downloadgoogletest-18b67bfc58b1c5657198e5d7e5cc9a99049b154e.tar.gz
googletest-18b67bfc58b1c5657198e5d7e5cc9a99049b154e.tar.bz2
googletest-18b67bfc58b1c5657198e5d7e5cc9a99049b154e.zip
Googletest export
Add extra filtering so that the reported message differentiates between the case where INSTANTIATE_TEST_SUITE_P is missing vs. the case where TEST_P is missing. PiperOrigin-RevId: 290114508
Diffstat (limited to 'googletest/test')
-rw-r--r--googletest/test/googletest-output-test-golden-lin.txt17
-rw-r--r--googletest/test/googletest-output-test_.cc4
2 files changed, 17 insertions, 4 deletions
diff --git a/googletest/test/googletest-output-test-golden-lin.txt b/googletest/test/googletest-output-test-golden-lin.txt
index 2b34aad3..8bc45800 100644
--- a/googletest/test/googletest-output-test-golden-lin.txt
+++ b/googletest/test/googletest-output-test-golden-lin.txt
@@ -12,7 +12,7 @@ Expected equality of these values:
3
Stack trace: (omitted)
-[==========] Running 87 tests from 41 test suites.
+[==========] Running 88 tests from 41 test suites.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
@@ -982,7 +982,16 @@ Expected failure
Stack trace: (omitted)
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
-[----------] 2 tests from GoogleTestVerification
+[----------] 3 tests from GoogleTestVerification
+[ RUN ] GoogleTestVerification.UninstantiatedParamaterizedTestSuite<NoTests>
+Paramaterized test suite NoTests is instantiated via INSTANTIATE_TEST_SUITE_P, but no tests are defined via TEST_P . No test cases will run.
+
+Ideally, INSTANTIATE_TEST_SUITE_P should only ever be invoked from code that always depend on code that provides TEST_P. Failing to do so is often an indication of dead code, e.g. the last TEST_P was removed but the rest got left behind.
+
+To suppress this error for this test suite, insert the following line (in a non-header) in the namespace it is defined in:
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(NoTests);
+[ OK ] GoogleTestVerification.UninstantiatedParamaterizedTestSuite<NoTests>
[ RUN ] GoogleTestVerification.UninstantiatedParamaterizedTestSuite<DetectNotInstantiatedTest>
Paramaterized test suite DetectNotInstantiatedTest is defined via TEST_P, but never instantiated. None of the test cases will run. Either no INSTANTIATE_TEST_SUITE_P is provided or the only ones provided expand to nothing.
@@ -1014,8 +1023,8 @@ Failed
Expected fatal failure.
Stack trace: (omitted)
-[==========] 87 tests from 41 test suites ran.
-[ PASSED ] 33 tests.
+[==========] 88 tests from 41 test suites ran.
+[ PASSED ] 34 tests.
[ FAILED ] 54 tests, listed below:
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ FAILED ] NonfatalFailureTest.DiffForLongStrings
diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc
index b1d66f9f..76af5bca 100644
--- a/googletest/test/googletest-output-test_.cc
+++ b/googletest/test/googletest-output-test_.cc
@@ -790,6 +790,10 @@ INSTANTIATE_TEST_SUITE_P(PrintingStrings,
testing::Values(std::string("a")),
ParamNameFunc);
+// The case where a suite has INSTANTIATE_TEST_SUITE_P but not TEST_P.
+using NoTests = ParamTest;
+INSTANTIATE_TEST_SUITE_P(ThisIsOdd, NoTests, ::testing::Values("Hello"));
+
// fails under kErrorOnUninstantiatedParameterizedTest=true
class DetectNotInstantiatedTest : public testing::TestWithParam<int> {};
TEST_P(DetectNotInstantiatedTest, Used) { }