Detect when C++ parametric tests (TEST_P) are not instantiated.
When an un-instantiated TEST_P is found, a new test will be inserted that will emit a warning message.
This can be made to error with minor code edits.
In the future, that is intended to be the default.
PiperOrigin-RevId: 284901666
@ -12,7 +12,7 @@ Expected equality of these values:
3
Stack trace: (omitted)
[0;32m[==========] [mRunning 84 tests from 39 test suites.
[0;32m[==========] [mRunning 85 tests from 40 test suites.
[0;32m[----------] [mGlobal test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
@ -979,6 +979,12 @@ Expected failure
Stack trace: (omitted)
[0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[0;32m[----------] [m1 test from GoogleTestVerification
[0;32m[ RUN ] [mGoogleTestVerification.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.
Ideally, TEST_P definitions should only ever be included as part of binaries that intend to use them. (As opposed to, for example, being placed in a library that may be linked in to get other utilities.)
[0;32m[ OK ] [mGoogleTestVerification.UninstantiatedParamaterizedTestSuite<DetectNotInstantiatedTest>
[0;32m[----------] [mGlobal test environment tear-down
BarEnvironment::TearDown() called.
googletest-output-test_.cc:#: Failure
@ -992,8 +998,8 @@ Failed
Expected fatal failure.
Stack trace: (omitted)
[0;32m[==========] [m84 tests from 39 test suites ran.
[0;32m[ PASSED ] [m30 tests.
[0;32m[==========] [m85 tests from 40 test suites ran.