diff options
26 files changed, 145 insertions, 112 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b5cf3c..089ac98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.13) project(googletest-distribution) -set(GOOGLETEST_VERSION 1.13.0) +set(GOOGLETEST_VERSION 1.14.0) if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX) set(CMAKE_CXX_EXTENSIONS OFF) @@ -9,7 +9,7 @@ GoogleTest now follows the We recommend [updating to the latest commit in the `main` branch as often as possible](https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it). We do publish occasional semantic versions, tagged with -`v${major}.${minor}.${patch}` (e.g. `v1.13.0`). +`v${major}.${minor}.${patch}` (e.g. `v1.14.0`). #### Documentation Updates @@ -17,12 +17,12 @@ Our documentation is now live on GitHub Pages at https://google.github.io/googletest/. We recommend browsing the documentation on GitHub Pages rather than directly in the repository. -#### Release 1.13.0 +#### Release 1.14.0 -[Release 1.13.0](https://github.com/google/googletest/releases/tag/v1.13.0) is +[Release 1.14.0](https://github.com/google/googletest/releases/tag/v1.14.0) is now available. -The 1.13.x branch requires at least C++14. +The 1.14.x branch requires at least C++14. #### Continuous Integration @@ -6,22 +6,22 @@ googletest_deps() load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( - name = "rules_python", # 2023-01-10T22:00:51Z - sha256 = "5de54486a60ad8948dabe49605bb1c08053e04001a431ab3e96745b4d97a4419", - strip_prefix = "rules_python-70cce26432187a60b4e950118791385e6fb3c26f", - urls = ["https://github.com/bazelbuild/rules_python/archive/70cce26432187a60b4e950118791385e6fb3c26f.zip"], + name = "rules_python", # 2023-07-31T20:39:27Z + sha256 = "1250b59a33c591a1c4ba68c62e95fc88a84c334ec35a2e23f46cbc1b9a5a8b55", + strip_prefix = "rules_python-e355becc30275939d87116a4ec83dad4bb50d9e1", + urls = ["https://github.com/bazelbuild/rules_python/archive/e355becc30275939d87116a4ec83dad4bb50d9e1.zip"], ) http_archive( - name = "bazel_skylib", # 2022-11-16T18:29:32Z - sha256 = "a22290c26d29d3ecca286466f7f295ac6cbe32c0a9da3a91176a90e0725e3649", - strip_prefix = "bazel-skylib-5bfcb1a684550626ce138fe0fe8f5f702b3764c3", - urls = ["https://github.com/bazelbuild/bazel-skylib/archive/5bfcb1a684550626ce138fe0fe8f5f702b3764c3.zip"], + name = "bazel_skylib", # 2023-05-31T19:24:07Z + sha256 = "08c0386f45821ce246bbbf77503c973246ed6ee5c3463e41efc197fa9bc3a7f4", + strip_prefix = "bazel-skylib-288731ef9f7f688932bd50e704a91a45ec185f9b", + urls = ["https://github.com/bazelbuild/bazel-skylib/archive/288731ef9f7f688932bd50e704a91a45ec185f9b.zip"], ) http_archive( - name = "platforms", # 2022-11-09T19:18:22Z - sha256 = "b4a3b45dc4202e2b3e34e3bc49d2b5b37295fc23ea58d88fb9e01f3642ad9b55", - strip_prefix = "platforms-3fbc687756043fb58a407c2ea8c944bc2fe1d922", - urls = ["https://github.com/bazelbuild/platforms/archive/3fbc687756043fb58a407c2ea8c944bc2fe1d922.zip"], + name = "platforms", # 2023-07-28T19:44:27Z + sha256 = "40eb313613ff00a5c03eed20aba58890046f4d38dec7344f00bb9a8867853526", + strip_prefix = "platforms-4ad40ef271da8176d4fc0194d2089b8a76e19d7b", + urls = ["https://github.com/bazelbuild/platforms/archive/4ad40ef271da8176d4fc0194d2089b8a76e19d7b.zip"], ) diff --git a/docs/advanced.md b/docs/advanced.md index 3871db1..344d541 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -899,10 +899,10 @@ also supports per-test-suite set-up/tear-down. To use it: variables to hold the shared resources. 2. Outside your test fixture class (typically just below it), define those member variables, optionally giving them initial values. -3. In the same test fixture class, define a `static void SetUpTestSuite()` - function (remember not to spell it as **`SetupTestSuite`** with a small - `u`!) to set up the shared resources and a `static void TearDownTestSuite()` - function to tear them down. +3. In the same test fixture class, define a public member function `static void + SetUpTestSuite()` (remember not to spell it as **`SetupTestSuite`** with a + small `u`!) to set up the shared resources and a `static void + TearDownTestSuite()` function to tear them down. That's it! GoogleTest automatically calls `SetUpTestSuite()` before running the *first test* in the `FooTest` test suite (i.e. before creating the first diff --git a/docs/gmock_cheat_sheet.md b/docs/gmock_cheat_sheet.md index 2fb0403..ddafaaa 100644 --- a/docs/gmock_cheat_sheet.md +++ b/docs/gmock_cheat_sheet.md @@ -20,7 +20,7 @@ class Foo { (note that `~Foo()` **must** be virtual) we can define its mock as ```cpp -#include "gmock/gmock.h" +#include <gmock/gmock.h> class MockFoo : public Foo { public: diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md index e319bf6..da10918 100644 --- a/docs/gmock_cook_book.md +++ b/docs/gmock_cook_book.md @@ -3194,7 +3194,7 @@ You can unlock this power by running your test with the `--gmock_verbose=info` flag. For example, given the test program: ```cpp -#include "gmock/gmock.h" +#include <gmock/gmock.h> using ::testing::_; using ::testing::HasSubstr; diff --git a/docs/gmock_for_dummies.md b/docs/gmock_for_dummies.md index b7264d3..43f907a 100644 --- a/docs/gmock_for_dummies.md +++ b/docs/gmock_for_dummies.md @@ -164,7 +164,7 @@ follow: After the process, you should have something like: ```cpp -#include "gmock/gmock.h" // Brings in gMock. +#include <gmock/gmock.h> // Brings in gMock. class MockTurtle : public Turtle { public: @@ -224,8 +224,8 @@ Here's an example: ```cpp #include "path/to/mock-turtle.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> using ::testing::AtLeast; // #1 diff --git a/docs/primer.md b/docs/primer.md index c3aee3c..f2a97a7 100644 --- a/docs/primer.md +++ b/docs/primer.md @@ -395,7 +395,7 @@ You can start from this boilerplate: ```c++ #include "this/package/foo.h" -#include "gtest/gtest.h" +#include <gtest/gtest.h> namespace my { namespace project { diff --git a/docs/reference/assertions.md b/docs/reference/assertions.md index 1cdff26..492ff5e 100644 --- a/docs/reference/assertions.md +++ b/docs/reference/assertions.md @@ -1,7 +1,7 @@ # Assertions Reference This page lists the assertion macros provided by GoogleTest for verifying code -behavior. To use them, include the header `gtest/gtest.h`. +behavior. To use them, add `#include <gtest/gtest.h>`. The majority of the macros listed below come as a pair with an `EXPECT_` variant and an `ASSERT_` variant. Upon failure, `EXPECT_` macros generate nonfatal @@ -88,7 +88,7 @@ For example, the following code verifies that the string `value1` starts with 10: ```cpp -#include "gmock/gmock.h" +#include <gmock/gmock.h> using ::testing::AllOf; using ::testing::Gt; diff --git a/docs/reference/mocking.md b/docs/reference/mocking.md index e414ffb..ab37ebf 100644 --- a/docs/reference/mocking.md +++ b/docs/reference/mocking.md @@ -1,8 +1,7 @@ # Mocking Reference This page lists the facilities provided by GoogleTest for creating and working -with mock objects. To use them, include the header -`gmock/gmock.h`. +with mock objects. To use them, add `#include <gmock/gmock.h>`. ## Macros {#macros} diff --git a/docs/reference/testing.md b/docs/reference/testing.md index 17225a6..ead66b3 100644 --- a/docs/reference/testing.md +++ b/docs/reference/testing.md @@ -3,7 +3,7 @@ <!--* toc_depth: 3 *--> This page lists the facilities provided by GoogleTest for writing test programs. -To use them, include the header `gtest/gtest.h`. +To use them, add `#include <gtest/gtest.h>`. ## Macros diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index bd9ba73..f20258b 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -175,9 +175,15 @@ struct BuiltInDefaultValueGetter<T, false> { static T Get() { Assert(false, __FILE__, __LINE__, "Default action undefined for the function return type."); - return internal::Invalid<T>(); +#if defined(__GNUC__) || defined(__clang__) + __builtin_unreachable(); +#elif defined(_MSC_VER) + __assume(0); +#else + return Invalid<T>(); // The above statement will never be reached, but is required in // order for this function to compile. +#endif } }; diff --git a/googletest/README.md b/googletest/README.md index 6bbd7f8..9331fce 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -25,7 +25,7 @@ When building GoogleTest as a standalone project, the typical workflow starts with ``` -git clone https://github.com/google/googletest.git -b v1.13.0 +git clone https://github.com/google/googletest.git -b v1.14.0 cd googletest # Main directory of the cloned repository. mkdir build # Create a directory to hold the build output. cd build @@ -145,7 +145,7 @@ We list the most frequently used macros below. For a complete list, see file ### Multi-threaded Tests GoogleTest is thread-safe where the pthread library is available. After -`#include "gtest/gtest.h"`, you can check the +`#include <gtest/gtest.h>`, you can check the `GTEST_IS_THREADSAFE` macro to see whether this is the case (yes if the macro is `#defined` to 1, no if it's undefined.). diff --git a/googletest/include/gtest/gtest-message.h b/googletest/include/gtest/gtest-message.h index 4d4b152..59b805e 100644 --- a/googletest/include/gtest/gtest-message.h +++ b/googletest/include/gtest/gtest-message.h @@ -56,6 +56,13 @@ #include "gtest/internal/gtest-port.h" +#ifdef GTEST_HAS_ABSL +#include <type_traits> + +#include "absl/strings/internal/has_absl_stringify.h" +#include "absl/strings/str_cat.h" +#endif // GTEST_HAS_ABSL + GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) @@ -111,8 +118,17 @@ class GTEST_API_ Message { *ss_ << str; } - // Streams a non-pointer value to this object. - template <typename T> + // Streams a non-pointer value to this object. If building a version of + // GoogleTest with ABSL, this overload is only enabled if the value does not + // have an AbslStringify definition. + template <typename T +#ifdef GTEST_HAS_ABSL + , + typename std::enable_if< + !absl::strings_internal::HasAbslStringify<T>::value, // NOLINT + int>::type = 0 +#endif // GTEST_HAS_ABSL + > inline Message& operator<<(const T& val) { // Some libraries overload << for STL containers. These // overloads are defined in the global namespace instead of ::std. @@ -133,6 +149,22 @@ class GTEST_API_ Message { return *this; } +#ifdef GTEST_HAS_ABSL + // Streams a non-pointer value with an AbslStringify definition to this + // object. + template <typename T, + typename std::enable_if< + absl::strings_internal::HasAbslStringify<T>::value, // NOLINT + int>::type = 0> + inline Message& operator<<(const T& val) { + // ::operator<< is needed here for a similar reason as with the non-Abseil + // version above + using ::operator<<; + *ss_ << absl::StrCat(val); + return *this; + } +#endif // GTEST_HAS_ABSL + // Streams a pointer value to this object. // // This function is an overload of the previous one. When you diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index de7d528..a932e68 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -51,7 +51,6 @@ #include <cstddef> #include <cstdint> -#include <iomanip> #include <limits> #include <memory> #include <ostream> @@ -1574,12 +1573,12 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, } ::std::stringstream lhs_ss; - lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) - << lhs_value; + lhs_ss.precision(std::numeric_limits<RawType>::digits10 + 2); + lhs_ss << lhs_value; ::std::stringstream rhs_ss; - rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) - << rhs_value; + rhs_ss.precision(std::numeric_limits<RawType>::digits10 + 2); + rhs_ss << rhs_value; return EqFailure(lhs_expression, rhs_expression, StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss), diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index a04a920..97a9833 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -58,7 +58,6 @@ #include <cstdint> #include <functional> -#include <iomanip> #include <limits> #include <map> #include <set> diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index 6a81c37..dd39e98 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -584,7 +584,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { GTEST_CHECK_(IsValidParamName(param_name)) << "Parameterized test name '" << param_name - << "' is invalid, in " << file << " line " << line << std::endl; + << "' is invalid (contains spaces, dashes, underscores, or " + "non-alphanumeric characters), in " + << file << " line " << line << "" << std::endl; GTEST_CHECK_(test_param_names.count(param_name) == 0) << "Duplicate parameterized test name '" << param_name << "', in " diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 656df26..b887e24 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -220,7 +220,6 @@ // GTEST_HAS_ALT_PATH_SEP_ - Always defined to 0 or 1. // GTEST_WIDE_STRING_USES_UTF16_ - Always defined to 0 or 1. // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Always defined to 0 or 1. -// GTEST_HAS_DOWNCAST_ - Always defined to 0 or 1. // GTEST_HAS_NOTIFICATION_- Always defined to 0 or 1. // // Synchronization: @@ -313,10 +312,6 @@ #include "gtest/internal/custom/gtest-port.h" #include "gtest/internal/gtest-port-arch.h" -#ifndef GTEST_HAS_DOWNCAST_ -#define GTEST_HAS_DOWNCAST_ 0 -#endif - #ifndef GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ #define GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ 0 #endif @@ -1153,17 +1148,12 @@ inline To ImplicitCast_(To x) { // check to enforce this. template <class Derived, class Base> Derived* CheckedDowncastToActualType(Base* base) { + static_assert(std::is_base_of<Base, Derived>::value, + "target type not derived from source type"); #if GTEST_HAS_RTTI - GTEST_CHECK_(typeid(*base) == typeid(Derived)); -#endif - -#if GTEST_HAS_DOWNCAST_ - return ::down_cast<Derived*>(base); -#elif GTEST_HAS_RTTI - return dynamic_cast<Derived*>(base); // NOLINT -#else - return static_cast<Derived*>(base); // Poor man's downcast. + GTEST_CHECK_(base == nullptr || dynamic_cast<Derived*>(base) != nullptr); #endif + return static_cast<Derived*>(base); } #if GTEST_HAS_STREAM_REDIRECTION diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 1e9b5c2..5b7fcbd 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -672,7 +672,7 @@ class GTEST_API_ UnitTestImpl { void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc, internal::TearDownTestSuiteFunc tear_down_tc, TestInfo* test_info) { -#ifdef GTEST_HAS_FILE_SYSTEM +#if GTEST_HAS_FILE_SYSTEM // In order to support thread-safe death tests, we need to // remember the original working directory when the test program // was first invoked. We cannot do this in RUN_ALL_TESTS(), as diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index e56ee1a..66a315e 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3229,7 +3229,7 @@ static const char* GetAnsiColorCode(GTestColor color) { return "3"; default: assert(false); - return "9" ; + return "9"; } } diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 7754c13..1890b6f 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -64,6 +64,7 @@ cc_test( "googletest-global-environment-unittest_.cc", "googletest-break-on-failure-unittest_.cc", "googletest-listener-test.cc", + "googletest-message-test.cc", "googletest-output-test_.cc", "googletest-list-tests-unittest_.cc", "googletest-shuffle-test_.cc", diff --git a/googletest/test/googletest-message-test.cc b/googletest/test/googletest-message-test.cc index 54e9d43..bf1f094 100644 --- a/googletest/test/googletest-message-test.cc +++ b/googletest/test/googletest-message-test.cc @@ -36,10 +36,26 @@ #include "gtest/gtest-message.h" #include "gtest/gtest.h" +#ifdef GTEST_HAS_ABSL +#include "absl/strings/str_format.h" +#endif // GTEST_HAS_ABSL + namespace { using ::testing::Message; +#ifdef GTEST_HAS_ABSL +struct AbslStringifiablePoint { + template <typename Sink> + friend void AbslStringify(Sink& sink, const AbslStringifiablePoint& p) { + absl::Format(&sink, "(%d, %d)", p.x, p.y); + } + + int x; + int y; +}; +#endif // GTEST_HAS_ABSL + // Tests the testing::Message class // Tests the default constructor. @@ -128,6 +144,13 @@ TEST(MessageTest, StreamsInt) { EXPECT_EQ("123", (Message() << 123).GetString()); } +#ifdef GTEST_HAS_ABSL +// Tests streaming a type with an AbslStringify definition. +TEST(MessageTest, StreamsAbslStringify) { + EXPECT_EQ("(1, 2)", (Message() << AbslStringifiablePoint{1, 2}).GetString()); +} +#endif // GTEST_HAS_ABSL + // Tests that basic IO manipulators (endl, ends, and flush) can be // streamed to Message. TEST(MessageTest, StreamsBasicIoManip) { diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc index 32a2a7b..e0793ba 100644 --- a/googletest/test/googletest-port-test.cc +++ b/googletest/test/googletest-port-test.cc @@ -418,8 +418,8 @@ TYPED_TEST(RETest, ImplicitConstructorWorks) { const RE simple(TypeParam("hello")); EXPECT_STREQ("hello", simple.pattern()); - const RE normal(TypeParam(".*(\\w+)")); - EXPECT_STREQ(".*(\\w+)", normal.pattern()); + const RE normal(TypeParam(".*([[:alnum:]_]+)")); + EXPECT_STREQ(".*([[:alnum:]_]+)", normal.pattern()); } // Tests that RE's constructors reject invalid regular expressions. diff --git a/googletest/test/gtest_help_test.py b/googletest/test/gtest_help_test.py index 85a0c33..38fc90f 100755 --- a/googletest/test/gtest_help_test.py +++ b/googletest/test/gtest_help_test.py @@ -43,11 +43,22 @@ import sys from googletest.test import gtest_test_utils +FREEBSD = ('FreeBSD', 'GNU/kFreeBSD') +NETBSD = ('NetBSD',) +OPENBSD = ('OpenBSD',) + + +def is_bsd_based_os() -> bool: + """Determine whether or not the OS is BSD-based.""" + if os.name != 'posix': + return False + + return os.uname()[0] in (FREEBSD + NETBSD + OPENBSD) + + IS_DARWIN = os.name == 'posix' and os.uname()[0] == 'Darwin' IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' IS_GNUHURD = os.name == 'posix' and os.uname()[0] == 'GNU' -IS_GNUKFREEBSD = os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD' -IS_OPENBSD = os.name == 'posix' and os.uname()[0] == 'OpenBSD' IS_WINDOWS = os.name == 'nt' PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_help_test_') @@ -96,7 +107,7 @@ HELP_REGEX = re.compile( ) -def RunWithFlag(flag): +def run_with_flag(flag): """Runs gtest_help_test_ with the given flag. Returns: @@ -116,17 +127,14 @@ def RunWithFlag(flag): class GTestHelpTest(gtest_test_utils.TestCase): """Tests the --help flag and its equivalent forms.""" - def TestHelpFlag(self, flag): + def test_prints_help_with_full_flag(self): """Verifies correct behavior when help flag is specified. The right message must be printed and the tests must skipped when the given flag is specified. - - Args: - flag: A flag to pass to the binary or None. """ - exit_code, output = RunWithFlag(flag) + exit_code, output = run_with_flag('--help') if HAS_ABSL_FLAGS: # The Abseil flags library prints the ProgramUsageMessage() with # --help and returns 1. @@ -136,7 +144,7 @@ class GTestHelpTest(gtest_test_utils.TestCase): self.assertTrue(HELP_REGEX.search(output), output) - if IS_DARWIN or IS_LINUX or IS_GNUHURD or IS_GNUKFREEBSD or IS_OPENBSD: + if IS_DARWIN or IS_LINUX or IS_GNUHURD or is_bsd_based_os(): self.assertIn(STREAM_RESULT_TO_FLAG, output) else: self.assertNotIn(STREAM_RESULT_TO_FLAG, output) @@ -146,53 +154,27 @@ class GTestHelpTest(gtest_test_utils.TestCase): else: self.assertNotIn(DEATH_TEST_STYLE_FLAG, output) - def TestUnknownFlagWithAbseil(self, flag): - """Verifies correct behavior when an unknown flag is specified. - - The right message must be printed and the tests must - skipped when the given flag is specified. - - Args: - flag: A flag to pass to the binary or None. - """ - exit_code, output = RunWithFlag(flag) - self.assertEqual(1, exit_code) - self.assertIn('ERROR: Unknown command line flag', output) - - def TestNonHelpFlag(self, flag): + def test_runs_tests_without_help_flag(self): """Verifies correct behavior when no help flag is specified. Verifies that when no help flag is specified, the tests are run and the help message is not printed. - - Args: - flag: A flag to pass to the binary or None. """ - exit_code, output = RunWithFlag(flag) + exit_code, output = run_with_flag(None) self.assertNotEqual(exit_code, 0) self.assertFalse(HELP_REGEX.search(output), output) - def testPrintsHelpWithFullFlag(self): - self.TestHelpFlag('--help') - - def testRunsTestsWithoutHelpFlag(self): - """Verifies correct behavior when no help flag is specified. - - Verifies that when no help flag is specified, the tests are run - and the help message is not printed. - """ - - self.TestNonHelpFlag(None) - - def testRunsTestsWithGtestInternalFlag(self): + def test_runs_tests_with_gtest_internal_flag(self): """Verifies correct behavior when internal testing flag is specified. Verifies that the tests are run and no help message is printed when a flag starting with Google Test prefix and 'internal_' is supplied. """ - self.TestNonHelpFlag(INTERNAL_FLAG_FOR_TESTING) + exit_code, output = run_with_flag(INTERNAL_FLAG_FOR_TESTING) + self.assertNotEqual(exit_code, 0) + self.assertFalse(HELP_REGEX.search(output), output) if __name__ == '__main__': diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 6caa03f..67d776e 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -4113,7 +4113,7 @@ TEST(ExpectThrowTest, DoesNotGenerateUnreachableCodeWarning) { EXPECT_THROW(throw 1, int); EXPECT_NONFATAL_FAILURE(EXPECT_THROW(n++, int), ""); - EXPECT_NONFATAL_FAILURE(EXPECT_THROW(throw 1, const char*), ""); + EXPECT_NONFATAL_FAILURE(EXPECT_THROW(throw n, const char*), ""); EXPECT_NO_THROW(n++); EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(throw 1), ""); EXPECT_ANY_THROW(throw 1); diff --git a/googletest_deps.bzl b/googletest_deps.bzl index 5e807d7..e25f5a1 100644 --- a/googletest_deps.bzl +++ b/googletest_deps.bzl @@ -7,16 +7,16 @@ def googletest_deps(): if not native.existing_rule("com_googlesource_code_re2"): http_archive( - name = "com_googlesource_code_re2", # 2023-06-01 - sha256 = "1726508efc93a50854c92e3f7ac66eb28f0e57652e413f11d7c1e28f97d997ba", - strip_prefix = "re2-03da4fc0857c285e3a26782f6bc8931c4c950df4", - urls = ["https://github.com/google/re2/archive/03da4fc0857c285e3a26782f6bc8931c4c950df4.zip"], + name = "com_googlesource_code_re2", # 2023-03-17T11:36:51Z + sha256 = "cb8b5312a65f2598954545a76e8bce913f35fbb3a21a5c88797a4448e9f9b9d9", + strip_prefix = "re2-578843a516fd1da7084ae46209a75f3613b6065e", + urls = ["https://github.com/google/re2/archive/578843a516fd1da7084ae46209a75f3613b6065e.zip"], ) if not native.existing_rule("com_google_absl"): http_archive( - name = "com_google_absl", # 2023-04-06T14:42:25Z - sha256 = "a50452f02402262f9a61a8eedda60f76dda6b9538d36b34b55bce9f74a4d5ef8", - strip_prefix = "abseil-cpp-e73b9139ee9b853a4bd7812531442c138da09084", - urls = ["https://github.com/abseil/abseil-cpp/archive/e73b9139ee9b853a4bd7812531442c138da09084.zip"], + name = "com_google_absl", # 2023-08-01T14:59:13Z + sha256 = "d2c09bf3b3aba57ad87a56082020bee2948445407756e92ddaf3595396086853", + strip_prefix = "abseil-cpp-22091f4c0d6626b3ef40446ce3d4ccab19425ca3", + urls = ["https://github.com/abseil/abseil-cpp/archive/22091f4c0d6626b3ef40446ce3d4ccab19425ca3.zip"], ) |