Merge branch 'google:main' into custom_type_combine
This commit is contained in:
commit
dd969ed5fe
6
.github/workflows/gtest-ci.yml
vendored
6
.github/workflows/gtest-ci.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Tests
|
- name: Tests
|
||||||
run: bazel test --test_output=errors //...
|
run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
|
||||||
|
|
||||||
MacOs:
|
MacOs:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Tests
|
- name: Tests
|
||||||
run: bazel test --test_output=errors //...
|
run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
|
||||||
|
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
@ -40,4 +40,4 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Tests
|
- name: Tests
|
||||||
run: bazel test --test_output=errors //...
|
run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
|
||||||
|
@ -80,8 +80,8 @@ fairly rigid coding style, as defined by the
|
|||||||
[google-styleguide](https://github.com/google/styleguide) project. All patches
|
[google-styleguide](https://github.com/google/styleguide) project. All patches
|
||||||
will be expected to conform to the style outlined
|
will be expected to conform to the style outlined
|
||||||
[here](https://google.github.io/styleguide/cppguide.html). Use
|
[here](https://google.github.io/styleguide/cppguide.html). Use
|
||||||
[.clang-format](https://github.com/google/googletest/blob/master/.clang-format)
|
[.clang-format](https://github.com/google/googletest/blob/main/.clang-format) to
|
||||||
to check your formatting.
|
check your formatting.
|
||||||
|
|
||||||
## Requirements for Contributors
|
## Requirements for Contributors
|
||||||
|
|
||||||
|
41
README.md
41
README.md
@ -59,39 +59,12 @@ More information about building GoogleTest can be found at
|
|||||||
|
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
|
|
||||||
GoogleTest requires a codebase and compiler compliant with the C++14 standard or
|
GoogleTest follows Google's
|
||||||
newer.
|
[Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support).
|
||||||
|
See
|
||||||
The GoogleTest code is officially supported on the following platforms.
|
[this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)
|
||||||
Operating systems or tools not listed below are community-supported. For
|
for a list of currently supported versions compilers, platforms, and build
|
||||||
community-supported platforms, patches that do not complicate the code may be
|
tools.
|
||||||
considered.
|
|
||||||
|
|
||||||
If you notice any problems on your platform, please file an issue on the
|
|
||||||
[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues).
|
|
||||||
Pull requests containing fixes are welcome!
|
|
||||||
|
|
||||||
### Operating Systems
|
|
||||||
|
|
||||||
* Linux
|
|
||||||
* macOS
|
|
||||||
* Windows
|
|
||||||
|
|
||||||
### Compilers
|
|
||||||
|
|
||||||
* gcc 5.0+
|
|
||||||
* clang 5.0+
|
|
||||||
* MSVC 2015+
|
|
||||||
|
|
||||||
**macOS users:** Xcode 9.3+ provides clang 5.0+.
|
|
||||||
|
|
||||||
### Build Systems
|
|
||||||
|
|
||||||
* [Bazel](https://bazel.build/)
|
|
||||||
* [CMake](https://cmake.org/)
|
|
||||||
|
|
||||||
**Note:** Bazel is the build system used by the team internally and in tests.
|
|
||||||
CMake is supported on a best-effort basis and by the community.
|
|
||||||
|
|
||||||
## Who Is Using GoogleTest?
|
## Who Is Using GoogleTest?
|
||||||
|
|
||||||
@ -138,7 +111,7 @@ that generates stub code for GoogleTest.
|
|||||||
## Contributing Changes
|
## Contributing Changes
|
||||||
|
|
||||||
Please read
|
Please read
|
||||||
[`CONTRIBUTING.md`](https://github.com/google/googletest/blob/master/CONTRIBUTING.md)
|
[`CONTRIBUTING.md`](https://github.com/google/googletest/blob/main/CONTRIBUTING.md)
|
||||||
for details on how to contribute to this project.
|
for details on how to contribute to this project.
|
||||||
|
|
||||||
Happy testing!
|
Happy testing!
|
||||||
|
@ -80,6 +80,7 @@ time docker run \
|
|||||||
--copt="-Wuninitialized" \
|
--copt="-Wuninitialized" \
|
||||||
--copt="-Wno-error=pragmas" \
|
--copt="-Wno-error=pragmas" \
|
||||||
--distdir="/bazel-distdir" \
|
--distdir="/bazel-distdir" \
|
||||||
|
--features=external_include_paths \
|
||||||
--keep_going \
|
--keep_going \
|
||||||
--show_timestamps \
|
--show_timestamps \
|
||||||
--test_output=errors
|
--test_output=errors
|
||||||
@ -100,6 +101,7 @@ for std in ${STD}; do
|
|||||||
--copt="-Wuninitialized" \
|
--copt="-Wuninitialized" \
|
||||||
--define="absl=${absl}" \
|
--define="absl=${absl}" \
|
||||||
--distdir="/bazel-distdir" \
|
--distdir="/bazel-distdir" \
|
||||||
|
--features=external_include_paths \
|
||||||
--keep_going \
|
--keep_going \
|
||||||
--show_timestamps \
|
--show_timestamps \
|
||||||
--test_output=errors
|
--test_output=errors
|
||||||
@ -123,6 +125,7 @@ for std in ${STD}; do
|
|||||||
--copt="-Wuninitialized" \
|
--copt="-Wuninitialized" \
|
||||||
--define="absl=${absl}" \
|
--define="absl=${absl}" \
|
||||||
--distdir="/bazel-distdir" \
|
--distdir="/bazel-distdir" \
|
||||||
|
--features=external_include_paths \
|
||||||
--keep_going \
|
--keep_going \
|
||||||
--linkopt="--gcc-toolchain=/usr/local" \
|
--linkopt="--gcc-toolchain=/usr/local" \
|
||||||
--show_timestamps \
|
--show_timestamps \
|
||||||
|
@ -68,6 +68,7 @@ for absl in 0 1; do
|
|||||||
--copt="-Werror" \
|
--copt="-Werror" \
|
||||||
--cxxopt="-std=c++14" \
|
--cxxopt="-std=c++14" \
|
||||||
--define="absl=${absl}" \
|
--define="absl=${absl}" \
|
||||||
|
--features=external_include_paths \
|
||||||
--keep_going \
|
--keep_going \
|
||||||
--show_timestamps \
|
--show_timestamps \
|
||||||
--test_output=errors
|
--test_output=errors
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
<div class="footer">
|
<div class="footer">
|
||||||
GoogleTest ·
|
GoogleTest ·
|
||||||
<a href="https://github.com/google/googletest">GitHub Repository</a> ·
|
<a href="https://github.com/google/googletest">GitHub Repository</a> ·
|
||||||
<a href="https://github.com/google/googletest/blob/master/LICENSE">License</a> ·
|
<a href="https://github.com/google/googletest/blob/main/LICENSE">License</a> ·
|
||||||
<a href="https://policies.google.com/privacy">Privacy Policy</a>
|
<a href="https://policies.google.com/privacy">Privacy Policy</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1142,8 +1142,8 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FooTest);
|
|||||||
|
|
||||||
You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples.
|
You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples.
|
||||||
|
|
||||||
[sample7_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample7_unittest.cc "Parameterized Test example"
|
[sample7_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample7_unittest.cc "Parameterized Test example"
|
||||||
[sample8_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
|
[sample8_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
|
||||||
|
|
||||||
### Creating Value-Parameterized Abstract Tests
|
### Creating Value-Parameterized Abstract Tests
|
||||||
|
|
||||||
@ -1294,7 +1294,7 @@ TYPED_TEST(FooTest, HasPropertyA) { ... }
|
|||||||
|
|
||||||
You can see [sample6_unittest.cc] for a complete example.
|
You can see [sample6_unittest.cc] for a complete example.
|
||||||
|
|
||||||
[sample6_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample6_unittest.cc "Typed Test example"
|
[sample6_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample6_unittest.cc "Typed Test example"
|
||||||
|
|
||||||
## Type-Parameterized Tests
|
## Type-Parameterized Tests
|
||||||
|
|
||||||
@ -1733,7 +1733,7 @@ You can do so by adding one line:
|
|||||||
Now, sit back and enjoy a completely different output from your tests. For more
|
Now, sit back and enjoy a completely different output from your tests. For more
|
||||||
details, see [sample9_unittest.cc].
|
details, see [sample9_unittest.cc].
|
||||||
|
|
||||||
[sample9_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample9_unittest.cc "Event listener example"
|
[sample9_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample9_unittest.cc "Event listener example"
|
||||||
|
|
||||||
You may append more than one listener to the list. When an `On*Start()` or
|
You may append more than one listener to the list. When an `On*Start()` or
|
||||||
`OnTestPartResult()` event is fired, the listeners will receive it in the order
|
`OnTestPartResult()` event is fired, the listeners will receive it in the order
|
||||||
@ -1760,7 +1760,7 @@ by the former.
|
|||||||
|
|
||||||
See [sample10_unittest.cc] for an example of a failure-raising listener.
|
See [sample10_unittest.cc] for an example of a failure-raising listener.
|
||||||
|
|
||||||
[sample10_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample10_unittest.cc "Failure-raising listener example"
|
[sample10_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample10_unittest.cc "Failure-raising listener example"
|
||||||
|
|
||||||
## Running Test Programs: Advanced Options
|
## Running Test Programs: Advanced Options
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ If necessary, you can continue to derive test fixtures from a derived fixture.
|
|||||||
GoogleTest has no limit on how deep the hierarchy can be.
|
GoogleTest has no limit on how deep the hierarchy can be.
|
||||||
|
|
||||||
For a complete example using derived test fixtures, see
|
For a complete example using derived test fixtures, see
|
||||||
[sample5_unittest.cc](https://github.com/google/googletest/blob/master/googletest/samples/sample5_unittest.cc).
|
[sample5_unittest.cc](https://github.com/google/googletest/blob/main/googletest/samples/sample5_unittest.cc).
|
||||||
|
|
||||||
## My compiler complains "void value not ignored as it ought to be." What does this mean?
|
## My compiler complains "void value not ignored as it ought to be." What does this mean?
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Googletest Samples
|
# Googletest Samples
|
||||||
|
|
||||||
If you're like us, you'd like to look at
|
If you're like us, you'd like to look at
|
||||||
[googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples)
|
[googletest samples.](https://github.com/google/googletest/blob/main/googletest/samples)
|
||||||
The sample directory has a number of well-commented samples showing how to use a
|
The sample directory has a number of well-commented samples showing how to use a
|
||||||
variety of googletest features.
|
variety of googletest features.
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
// MORE INFORMATION:
|
// MORE INFORMATION:
|
||||||
//
|
//
|
||||||
// To learn more about using these macros, please search for 'ACTION' on
|
// To learn more about using these macros, please search for 'ACTION' on
|
||||||
// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
|
// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md
|
||||||
|
|
||||||
// IWYU pragma: private, include "gmock/gmock.h"
|
// IWYU pragma: private, include "gmock/gmock.h"
|
||||||
// IWYU pragma: friend gmock/.*
|
// IWYU pragma: friend gmock/.*
|
||||||
|
@ -240,7 +240,7 @@
|
|||||||
//
|
//
|
||||||
// To learn more about using these macros, please search for 'MATCHER'
|
// To learn more about using these macros, please search for 'MATCHER'
|
||||||
// on
|
// on
|
||||||
// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
|
// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md
|
||||||
//
|
//
|
||||||
// This file also implements some commonly used argument matchers. More
|
// This file also implements some commonly used argument matchers. More
|
||||||
// matchers can be defined by the user implementing the
|
// matchers can be defined by the user implementing the
|
||||||
@ -3245,6 +3245,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<18>, char) {
|
|||||||
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = t;
|
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = t;
|
||||||
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
|
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
|
||||||
}
|
}
|
||||||
|
template <typename T>
|
||||||
|
auto UnpackStructImpl(const T& t, MakeIndexSequence<19>, char) {
|
||||||
|
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s] = t;
|
||||||
|
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s);
|
||||||
|
}
|
||||||
#endif // defined(__cpp_structured_bindings)
|
#endif // defined(__cpp_structured_bindings)
|
||||||
|
|
||||||
template <size_t I, typename T>
|
template <size_t I, typename T>
|
||||||
|
@ -295,7 +295,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) {
|
|||||||
"call should not happen. Do not suppress it by blindly adding "
|
"call should not happen. Do not suppress it by blindly adding "
|
||||||
"an EXPECT_CALL() if you don't mean to enforce the call. "
|
"an EXPECT_CALL() if you don't mean to enforce the call. "
|
||||||
"See "
|
"See "
|
||||||
"https://github.com/google/googletest/blob/master/docs/"
|
"https://github.com/google/googletest/blob/main/docs/"
|
||||||
"gmock_cook_book.md#"
|
"gmock_cook_book.md#"
|
||||||
"knowing-when-to-expect for details.\n",
|
"knowing-when-to-expect for details.\n",
|
||||||
stack_frames_to_skip);
|
stack_frames_to_skip);
|
||||||
|
@ -1720,6 +1720,11 @@ TEST(FieldsAreTest, StructuredBindings) {
|
|||||||
};
|
};
|
||||||
EXPECT_THAT(MyVarType18{},
|
EXPECT_THAT(MyVarType18{},
|
||||||
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||||
|
struct MyVarType19 {
|
||||||
|
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s;
|
||||||
|
};
|
||||||
|
EXPECT_THAT(MyVarType19{}, FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2059,7 +2059,7 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture {
|
|||||||
"call should not happen. Do not suppress it by blindly adding "
|
"call should not happen. Do not suppress it by blindly adding "
|
||||||
"an EXPECT_CALL() if you don't mean to enforce the call. "
|
"an EXPECT_CALL() if you don't mean to enforce the call. "
|
||||||
"See "
|
"See "
|
||||||
"https://github.com/google/googletest/blob/master/docs/"
|
"https://github.com/google/googletest/blob/main/docs/"
|
||||||
"gmock_cook_book.md#"
|
"gmock_cook_book.md#"
|
||||||
"knowing-when-to-expect for details.";
|
"knowing-when-to-expect for details.";
|
||||||
|
|
||||||
|
@ -75,14 +75,14 @@ GMOCK WARNING:
|
|||||||
Uninteresting mock function call - returning default value.
|
Uninteresting mock function call - returning default value.
|
||||||
Function call: Bar2(0, 1)
|
Function call: Bar2(0, 1)
|
||||||
Returns: false
|
Returns: false
|
||||||
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
||||||
[ OK ] GMockOutputTest.UninterestingCall
|
[ OK ] GMockOutputTest.UninterestingCall
|
||||||
[ RUN ] GMockOutputTest.UninterestingCallToVoidFunction
|
[ RUN ] GMockOutputTest.UninterestingCallToVoidFunction
|
||||||
|
|
||||||
GMOCK WARNING:
|
GMOCK WARNING:
|
||||||
Uninteresting mock function call - returning directly.
|
Uninteresting mock function call - returning directly.
|
||||||
Function call: Bar3(0, 1)
|
Function call: Bar3(0, 1)
|
||||||
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
||||||
[ OK ] GMockOutputTest.UninterestingCallToVoidFunction
|
[ OK ] GMockOutputTest.UninterestingCallToVoidFunction
|
||||||
[ RUN ] GMockOutputTest.RetiredExpectation
|
[ RUN ] GMockOutputTest.RetiredExpectation
|
||||||
unknown file: Failure
|
unknown file: Failure
|
||||||
@ -266,14 +266,14 @@ Uninteresting mock function call - taking default action specified at:
|
|||||||
FILE:#:
|
FILE:#:
|
||||||
Function call: Bar2(2, 2)
|
Function call: Bar2(2, 2)
|
||||||
Returns: true
|
Returns: true
|
||||||
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
||||||
|
|
||||||
GMOCK WARNING:
|
GMOCK WARNING:
|
||||||
Uninteresting mock function call - taking default action specified at:
|
Uninteresting mock function call - taking default action specified at:
|
||||||
FILE:#:
|
FILE:#:
|
||||||
Function call: Bar2(1, 1)
|
Function call: Bar2(1, 1)
|
||||||
Returns: false
|
Returns: false
|
||||||
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
|
||||||
[ OK ] GMockOutputTest.UninterestingCallWithDefaultAction
|
[ OK ] GMockOutputTest.UninterestingCallWithDefaultAction
|
||||||
[ RUN ] GMockOutputTest.ExplicitActionsRunOutWithDefaultAction
|
[ RUN ] GMockOutputTest.ExplicitActionsRunOutWithDefaultAction
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ depends on which build system you use, and is usually straightforward.
|
|||||||
### Build with CMake
|
### Build with CMake
|
||||||
|
|
||||||
GoogleTest comes with a CMake build script
|
GoogleTest comes with a CMake build script
|
||||||
([CMakeLists.txt](https://github.com/google/googletest/blob/master/CMakeLists.txt))
|
([CMakeLists.txt](https://github.com/google/googletest/blob/main/CMakeLists.txt))
|
||||||
that can be used on a wide range of platforms ("C" stands for cross-platform.).
|
that can be used on a wide range of platforms ("C" stands for cross-platform.).
|
||||||
If you don't have CMake installed already, you can download it for free from
|
If you don't have CMake installed already, you can download it for free from
|
||||||
<http://www.cmake.org/>.
|
<http://www.cmake.org/>.
|
||||||
@ -140,7 +140,7 @@ command line. Generally, these macros are named like `GTEST_XYZ` and you define
|
|||||||
them to either 1 or 0 to enable or disable a certain feature.
|
them to either 1 or 0 to enable or disable a certain feature.
|
||||||
|
|
||||||
We list the most frequently used macros below. For a complete list, see file
|
We list the most frequently used macros below. For a complete list, see file
|
||||||
[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h).
|
[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/main/googletest/include/gtest/internal/gtest-port.h).
|
||||||
|
|
||||||
### Multi-threaded Tests
|
### Multi-threaded Tests
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ class MatchesRegexMatcher {
|
|||||||
template <class MatcheeStringType>
|
template <class MatcheeStringType>
|
||||||
bool MatchAndExplain(const MatcheeStringType& s,
|
bool MatchAndExplain(const MatcheeStringType& s,
|
||||||
MatchResultListener* /* listener */) const {
|
MatchResultListener* /* listener */) const {
|
||||||
const std::string& s2(s);
|
const std::string s2(s);
|
||||||
return full_match_ ? RE::FullMatch(s2, *regex_)
|
return full_match_ ? RE::FullMatch(s2, *regex_)
|
||||||
: RE::PartialMatch(s2, *regex_);
|
: RE::PartialMatch(s2, *regex_);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ static std::string DeathTestThreadWarning(size_t thread_count) {
|
|||||||
msg << "detected " << thread_count << " threads.";
|
msg << "detected " << thread_count << " threads.";
|
||||||
}
|
}
|
||||||
msg << " See "
|
msg << " See "
|
||||||
"https://github.com/google/googletest/blob/master/docs/"
|
"https://github.com/google/googletest/blob/main/docs/"
|
||||||
"advanced.md#death-tests-and-threads"
|
"advanced.md#death-tests-and-threads"
|
||||||
<< " for more explanation and suggested solutions, especially if"
|
<< " for more explanation and suggested solutions, especially if"
|
||||||
<< " this is the last message you see before your test times out.";
|
<< " this is the last message you see before your test times out.";
|
||||||
@ -284,7 +284,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
|
|||||||
// message is propagated back to the parent process. Otherwise, the
|
// message is propagated back to the parent process. Otherwise, the
|
||||||
// message is simply printed to stderr. In either case, the program
|
// message is simply printed to stderr. In either case, the program
|
||||||
// then exits with status 1.
|
// then exits with status 1.
|
||||||
static void DeathTestAbort(const std::string& message) {
|
[[noreturn]] static void DeathTestAbort(const std::string& message) {
|
||||||
// On a POSIX system, this function may be called from a threadsafe-style
|
// On a POSIX system, this function may be called from a threadsafe-style
|
||||||
// death test child process, which operates on a very small stack. Use
|
// death test child process, which operates on a very small stack. Use
|
||||||
// the heap for any additional non-minuscule memory requirements.
|
// the heap for any additional non-minuscule memory requirements.
|
||||||
|
@ -6039,7 +6039,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
|
|||||||
// each TestSuite and TestInfo object.
|
// each TestSuite and TestInfo object.
|
||||||
// If shard_tests == true, further filters tests based on sharding
|
// If shard_tests == true, further filters tests based on sharding
|
||||||
// variables in the environment - see
|
// variables in the environment - see
|
||||||
// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md
|
// https://github.com/google/googletest/blob/main/docs/advanced.md
|
||||||
// . Returns the number of tests that should run.
|
// . Returns the number of tests that should run.
|
||||||
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
|
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
|
||||||
const int32_t total_shards = shard_tests == HONOR_SHARDING_PROTOCOL
|
const int32_t total_shards = shard_tests == HONOR_SHARDING_PROTOCOL
|
||||||
|
@ -3454,10 +3454,10 @@ TEST_F(NoFatalFailureTest, MessageIsStreamable) {
|
|||||||
TestPartResultArray gtest_failures;
|
TestPartResultArray gtest_failures;
|
||||||
{
|
{
|
||||||
ScopedFakeTestPartResultReporter gtest_reporter(>est_failures);
|
ScopedFakeTestPartResultReporter gtest_reporter(>est_failures);
|
||||||
EXPECT_NO_FATAL_FAILURE(FAIL() << "foo") << "my message";
|
EXPECT_NO_FATAL_FAILURE([] { FAIL() << "foo"; }()) << "my message";
|
||||||
}
|
}
|
||||||
ASSERT_EQ(2, gtest_failures.size());
|
ASSERT_EQ(2, gtest_failures.size());
|
||||||
EXPECT_EQ(TestPartResult::kNonFatalFailure,
|
EXPECT_EQ(TestPartResult::kFatalFailure,
|
||||||
gtest_failures.GetTestPartResult(0).type());
|
gtest_failures.GetTestPartResult(0).type());
|
||||||
EXPECT_EQ(TestPartResult::kNonFatalFailure,
|
EXPECT_EQ(TestPartResult::kNonFatalFailure,
|
||||||
gtest_failures.GetTestPartResult(1).type());
|
gtest_failures.GetTestPartResult(1).type());
|
||||||
|
Loading…
Reference in New Issue
Block a user