Googletest export
Standardize access to GoogleTest flags on GTEST_FLAG_GET/GTEST_FLAG_SET Custom implementations can decide how access to flags is performed depending on the implementation of flags being used. PiperOrigin-RevId: 391971115
This commit is contained in:
		
				
					committed by
					
						
						Samuel Benzaquen
					
				
			
			
				
	
			
			
			
						parent
						
							0134d73a49
						
					
				
				
					commit
					2f80c2ba71
				
			@@ -557,7 +557,7 @@ The automated testing framework does not set the style flag. You can choose a
 | 
				
			|||||||
particular style of death tests by setting the flag programmatically:
 | 
					particular style of death tests by setting the flag programmatically:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```c++
 | 
					```c++
 | 
				
			||||||
testing::FLAGS_gtest_death_test_style="threadsafe"
 | 
					GTEST_FLAG_SET(death_test_style, "threadsafe")
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can do this in `main()` to set the style for all death tests in the binary,
 | 
					You can do this in `main()` to set the style for all death tests in the binary,
 | 
				
			||||||
@@ -567,12 +567,12 @@ restored afterwards, so you need not do that yourself. For example:
 | 
				
			|||||||
```c++
 | 
					```c++
 | 
				
			||||||
int main(int argc, char** argv) {
 | 
					int main(int argc, char** argv) {
 | 
				
			||||||
  testing::InitGoogleTest(&argc, argv);
 | 
					  testing::InitGoogleTest(&argc, argv);
 | 
				
			||||||
  GTEST_FLAG_SET(gtest_death_test_style, "fast");
 | 
					  GTEST_FLAG_SET(death_test_style, "fast");
 | 
				
			||||||
  return RUN_ALL_TESTS();
 | 
					  return RUN_ALL_TESTS();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(MyDeathTest, TestOne) {
 | 
					TEST(MyDeathTest, TestOne) {
 | 
				
			||||||
  GTEST_FLAG_SET(gtest_death_test_style, "threadsafe");
 | 
					  GTEST_FLAG_SET(death_test_style, "threadsafe");
 | 
				
			||||||
  // This test is run in the "threadsafe" style:
 | 
					  // This test is run in the "threadsafe" style:
 | 
				
			||||||
  ASSERT_DEATH(ThisShouldDie(), "");
 | 
					  ASSERT_DEATH(ThisShouldDie(), "");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user