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
This commit is contained in:
		@@ -1597,6 +1597,7 @@ void RegisterMyTests(const std::vector<int>& values) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
...
 | 
					...
 | 
				
			||||||
int main(int argc, char** argv) {
 | 
					int main(int argc, char** argv) {
 | 
				
			||||||
 | 
					  testing::InitGoogleTest(&argc, argv);
 | 
				
			||||||
  std::vector<int> values_to_test = LoadValuesFromConfig();
 | 
					  std::vector<int> values_to_test = LoadValuesFromConfig();
 | 
				
			||||||
  RegisterMyTests(values_to_test);
 | 
					  RegisterMyTests(values_to_test);
 | 
				
			||||||
  ...
 | 
					  ...
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2451,6 +2451,7 @@ GTEST_API_ std::string TempDir();
 | 
				
			|||||||
// }
 | 
					// }
 | 
				
			||||||
// ...
 | 
					// ...
 | 
				
			||||||
// int main(int argc, char** argv) {
 | 
					// int main(int argc, char** argv) {
 | 
				
			||||||
 | 
					//   ::testing::InitGoogleTest(&argc, argv);
 | 
				
			||||||
//   std::vector<int> values_to_test = LoadValuesFromConfig();
 | 
					//   std::vector<int> values_to_test = LoadValuesFromConfig();
 | 
				
			||||||
//   RegisterMyTests(values_to_test);
 | 
					//   RegisterMyTests(values_to_test);
 | 
				
			||||||
//   ...
 | 
					//   ...
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user