Skip to content

Commit aa486f1

Browse files
Abseil Teamdinord
Abseil Team
authored andcommitted
Googletest export
Add missing InitGoogleTest line in "Registering tests" example code Copying the original code gives the following error message """ IMPORTANT NOTICE - DO NOT IGNORE: This test program did NOT call testing::InitGoogleTest() before calling RUN_ALL_TESTS(). This is INVALID. Soon Google Test will start to enforce the valid usage. Please fix it ASAP, or IT WILL START TO FAIL. """ PiperOrigin-RevId: 408385714
1 parent c379282 commit aa486f1

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

docs/advanced.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,7 @@ void RegisterMyTests(const std::vector<int>& values) {
15971597
}
15981598
...
15991599
int main(int argc, char** argv) {
1600+
testing::InitGoogleTest(&argc, argv);
16001601
std::vector<int> values_to_test = LoadValuesFromConfig();
16011602
RegisterMyTests(values_to_test);
16021603
...

googletest/include/gtest/gtest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,7 @@ GTEST_API_ std::string TempDir();
24512451
// }
24522452
// ...
24532453
// int main(int argc, char** argv) {
2454+
// ::testing::InitGoogleTest(&argc, argv);
24542455
// std::vector<int> values_to_test = LoadValuesFromConfig();
24552456
// RegisterMyTests(values_to_test);
24562457
// ...

0 commit comments

Comments
 (0)