mirror of
https://github.com/google/googletest.git
synced 2025-11-08 22:33:51 -05:00
Adds support for a --gtest_fail_if_no_test_linked flag
to fail the test program if no test case is linked in (a common programmer mistake). PiperOrigin-RevId: 730571311 Change-Id: I1dab04adfe35581274d0b4ec79a017014d50e1ea
This commit is contained in:
committed by
Copybara-Service
parent
3fbe4db9a3
commit
54501746a6
@@ -1929,6 +1929,20 @@ the `--gtest_also_run_disabled_tests` flag or set the
|
||||
You can combine this with the `--gtest_filter` flag to further select which
|
||||
disabled tests to run.
|
||||
|
||||
### Enforcing Having At Least One Test Case
|
||||
|
||||
A not uncommon programmer mistake is to write a test program that has no test
|
||||
case linked in. This can happen, for example, when you put test case definitions
|
||||
in a library and the library is not marked as "always link".
|
||||
|
||||
To catch such mistakes, run the test program with the
|
||||
`--gtest_fail_if_no_test_linked` flag or set the `GTEST_FAIL_IF_NO_TEST_LINKED`
|
||||
environment variable to a value other than `0`. Now the program will fail if no
|
||||
test case is linked in.
|
||||
|
||||
Note that *any* test case linked in makes the program valid for the purpose of
|
||||
this check. In particular, even a disabled test case suffices.
|
||||
|
||||
### Repeating the Tests
|
||||
|
||||
Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it
|
||||
|
||||
Reference in New Issue
Block a user