diff --git a/docs/primer.md b/docs/primer.md index f6318a5d..aecc368b 100644 --- a/docs/primer.md +++ b/docs/primer.md @@ -274,8 +274,8 @@ First, define a fixture class. By convention, you should give it the name class QueueTest : public ::testing::Test { protected: void SetUp() override { - q0_.Enqueue(1); - q1_.Enqueue(2); + q1_.Enqueue(1); + q2_.Enqueue(2); q2_.Enqueue(3); } diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 0c7983ae..5a34c07a 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -154,10 +154,6 @@ function(cxx_library_with_type name type cxx_flags) set_target_properties(${name} PROPERTIES COMPILE_FLAGS "${cxx_flags}") - # Generate debug library name with a postfix. - set_target_properties(${name} - PROPERTIES - DEBUG_POSTFIX "d") # Set the output directory for build artifacts set_target_properties(${name} PROPERTIES diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 642c742c..7a50e18a 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -317,7 +317,7 @@ GTEST_DEFINE_int32_( GTEST_DEFINE_bool_( recreate_environments_when_repeating, testing::internal::BoolFromGTestEnv("recreate_environments_when_repeating", - true), + false), "Controls whether global test environments are recreated for each repeat " "of the tests. If set to false the global test environments are only set " "up once, for the first iteration, and only torn down once, for the last. " diff --git a/googletest/test/googletest-global-environment-unittest.py b/googletest/test/googletest-global-environment-unittest.py index ef2cfb85..26579344 100644 --- a/googletest/test/googletest-global-environment-unittest.py +++ b/googletest/test/googletest-global-environment-unittest.py @@ -71,10 +71,13 @@ class GTestGlobalEnvironmentUnitTest(gtest_test_utils.TestCase): def testEnvironmentSetUpAndTornDownForEachRepeat(self): """Tests the behavior of test environments and gtest_repeat.""" - txt = RunAndReturnOutput(['--gtest_repeat=2']) + # When --gtest_recreate_environments_when_repeating is true, the global test + # environment should be set up and torn down for each iteration. + txt = RunAndReturnOutput([ + '--gtest_repeat=2', + '--gtest_recreate_environments_when_repeating=true', + ]) - # By default, with gtest_repeat=2, the global test environment should be set - # up and torn down for each iteration. expected_pattern = ('(.|\n)*' r'Repeating all tests \(iteration 1\)' '(.|\n)*' @@ -97,13 +100,12 @@ class GTestGlobalEnvironmentUnitTest(gtest_test_utils.TestCase): def testEnvironmentSetUpAndTornDownOnce(self): """Tests environment and --gtest_recreate_environments_when_repeating.""" + # By default the environment should only be set up and torn down once, at + # the start and end of the test respectively. txt = RunAndReturnOutput([ - '--gtest_repeat=2', '--gtest_recreate_environments_when_repeating=false' + '--gtest_repeat=2', ]) - # When --gtest_recreate_environments_when_repeating is false, the test - # environment should only be set up and torn down once, at the start and - # end of the test respectively. expected_pattern = ('(.|\n)*' r'Repeating all tests \(iteration 1\)' '(.|\n)*' diff --git a/googletest/test/googletest-listener-test.cc b/googletest/test/googletest-listener-test.cc index 9d6c9cab..e7f9b13f 100644 --- a/googletest/test/googletest-listener-test.cc +++ b/googletest/test/googletest-listener-test.cc @@ -285,6 +285,7 @@ int main(int argc, char **argv) { << "AddGlobalTestEnvironment should not generate any events itself."; GTEST_FLAG_SET(repeat, 2); + GTEST_FLAG_SET(recreate_environments_when_repeating, true); int ret_val = RUN_ALL_TESTS(); #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc index c7af3efb..6b10048f 100644 --- a/googletest/test/gtest_repeat_test.cc +++ b/googletest/test/gtest_repeat_test.cc @@ -142,6 +142,7 @@ void TestRepeatUnspecified() { // Tests the behavior of Google Test when --gtest_repeat has the given value. void TestRepeat(int repeat) { GTEST_FLAG_SET(repeat, repeat); + GTEST_FLAG_SET(recreate_environments_when_repeating, true); ResetCounts(); GTEST_CHECK_INT_EQ_(repeat > 0 ? 1 : 0, RUN_ALL_TESTS()); @@ -152,6 +153,7 @@ void TestRepeat(int repeat) { // set of tests. void TestRepeatWithEmptyFilter(int repeat) { GTEST_FLAG_SET(repeat, repeat); + GTEST_FLAG_SET(recreate_environments_when_repeating, true); GTEST_FLAG_SET(filter, "None"); ResetCounts(); @@ -163,6 +165,7 @@ void TestRepeatWithEmptyFilter(int repeat) { // successful tests. void TestRepeatWithFilterForSuccessfulTests(int repeat) { GTEST_FLAG_SET(repeat, repeat); + GTEST_FLAG_SET(recreate_environments_when_repeating, true); GTEST_FLAG_SET(filter, "*-*ShouldFail"); ResetCounts(); @@ -179,6 +182,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) { // failed tests. void TestRepeatWithFilterForFailedTests(int repeat) { GTEST_FLAG_SET(repeat, repeat); + GTEST_FLAG_SET(recreate_environments_when_repeating, true); GTEST_FLAG_SET(filter, "*ShouldFail"); ResetCounts();