Merge branch 'google:main' into master
This commit is contained in:
commit
c538aa9ddb
3
.github/workflows/gtest-ci.yml
vendored
3
.github/workflows/gtest-ci.yml
vendored
@ -4,6 +4,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
BAZEL_CXXOPTS: -std=c++14
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Linux:
|
Linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -7,12 +7,16 @@ if (POLICY CMP0048)
|
|||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
endif (POLICY CMP0048)
|
endif (POLICY CMP0048)
|
||||||
|
|
||||||
|
if (POLICY CMP0069)
|
||||||
|
cmake_policy(SET CMP0069 NEW)
|
||||||
|
endif (POLICY CMP0069)
|
||||||
|
|
||||||
if (POLICY CMP0077)
|
if (POLICY CMP0077)
|
||||||
cmake_policy(SET CMP0077 NEW)
|
cmake_policy(SET CMP0077 NEW)
|
||||||
endif (POLICY CMP0077)
|
endif (POLICY CMP0077)
|
||||||
|
|
||||||
project(googletest-distribution)
|
project(googletest-distribution)
|
||||||
set(GOOGLETEST_VERSION 1.11.0)
|
set(GOOGLETEST_VERSION 1.12.1)
|
||||||
|
|
||||||
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
|
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
@ -15,11 +15,14 @@ Our documentation is now live on GitHub Pages at
|
|||||||
https://google.github.io/googletest/. We recommend browsing the documentation on
|
https://google.github.io/googletest/. We recommend browsing the documentation on
|
||||||
GitHub Pages rather than directly in the repository.
|
GitHub Pages rather than directly in the repository.
|
||||||
|
|
||||||
#### Release 1.11.0
|
#### Release 1.12.1
|
||||||
|
|
||||||
[Release 1.11.0](https://github.com/google/googletest/releases/tag/release-1.11.0)
|
[Release 1.12.1](https://github.com/google/googletest/releases/tag/release-1.12.1)
|
||||||
is now available.
|
is now available.
|
||||||
|
|
||||||
|
The 1.12.x branch will be the last to support C++11. Future releases will
|
||||||
|
require at least C++14.
|
||||||
|
|
||||||
#### Coming Soon
|
#### Coming Soon
|
||||||
|
|
||||||
* We are planning to take a dependency on
|
* We are planning to take a dependency on
|
||||||
@ -56,7 +59,7 @@ More information about building GoogleTest can be found at
|
|||||||
|
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
|
|
||||||
GoogleTest requires a codebase and compiler compliant with the C++11 standard or
|
GoogleTest requires a codebase and compiler compliant with the C++14 standard or
|
||||||
newer.
|
newer.
|
||||||
|
|
||||||
The GoogleTest code is officially supported on the following platforms.
|
The GoogleTest code is officially supported on the following platforms.
|
||||||
|
24
WORKSPACE
24
WORKSPACE
@ -4,25 +4,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "com_google_absl",
|
name = "com_google_absl",
|
||||||
sha256 = "f88c0030547281e8283ff183db61564ff08d3322a8c2e2de4c40e38c03c69aea",
|
sha256 = "1a1745b5ee81392f5ea4371a4ca41e55d446eeaee122903b2eaffbd8a3b67a2b",
|
||||||
strip_prefix = "abseil-cpp-c27ab06897f330267bed99061ed3e523e2606bf1",
|
strip_prefix = "abseil-cpp-01cc6567cff77738e416a7ddc17de2d435a780ce",
|
||||||
urls = ["https://github.com/abseil/abseil-cpp/archive/c27ab06897f330267bed99061ed3e523e2606bf1.zip"], # 2022-04-18T19:51:27Z
|
urls = ["https://github.com/abseil/abseil-cpp/archive/01cc6567cff77738e416a7ddc17de2d435a780ce.zip"], # 2022-06-21T19:28:27Z
|
||||||
)
|
)
|
||||||
|
|
||||||
# Note this must use a commit from the `abseil` branch of the RE2 project.
|
# Note this must use a commit from the `abseil` branch of the RE2 project.
|
||||||
# https://github.com/google/re2/tree/abseil
|
# https://github.com/google/re2/tree/abseil
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "com_googlesource_code_re2",
|
name = "com_googlesource_code_re2",
|
||||||
sha256 = "906d0df8ff48f8d3a00a808827f009a840190f404559f649cb8e4d7143255ef9",
|
sha256 = "0a890c2aa0bb05b2ce906a15efb520d0f5ad4c7d37b8db959c43772802991887",
|
||||||
strip_prefix = "re2-a276a8c738735a0fe45a6ee590fe2df69bcf4502",
|
strip_prefix = "re2-a427f10b9fb4622dd6d8643032600aa1b50fbd12",
|
||||||
urls = ["https://github.com/google/re2/archive/a276a8c738735a0fe45a6ee590fe2df69bcf4502.zip"], # 2022-04-08
|
urls = ["https://github.com/google/re2/archive/a427f10b9fb4622dd6d8643032600aa1b50fbd12.zip"], # 2022-06-09
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "rules_python",
|
name = "rules_python",
|
||||||
sha256 = "98b3c592faea9636ac8444bfd9de7f3fb4c60590932d6e6ac5946e3f8dbd5ff6",
|
sha256 = "0b460f17771258341528753b1679335b629d1d25e3af28eda47d009c103a6e15",
|
||||||
strip_prefix = "rules_python-ed6cc8f2c3692a6a7f013ff8bc185ba77eb9b4d2",
|
strip_prefix = "rules_python-aef17ad72919d184e5edb7abf61509eb78e57eda",
|
||||||
urls = ["https://github.com/bazelbuild/rules_python/archive/ed6cc8f2c3692a6a7f013ff8bc185ba77eb9b4d2.zip"], # 2021-05-17T00:24:16Z
|
urls = ["https://github.com/bazelbuild/rules_python/archive/aef17ad72919d184e5edb7abf61509eb78e57eda.zip"], # 2022-06-21T23:44:47Z
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
@ -33,7 +33,7 @@ http_archive(
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "platforms",
|
name = "platforms",
|
||||||
sha256 = "b601beaf841244de5c5a50d2b2eddd34839788000fa1be4260ce6603ca0d8eb7",
|
sha256 = "a879ea428c6d56ab0ec18224f976515948822451473a80d06c2e50af0bbe5121",
|
||||||
strip_prefix = "platforms-98939346da932eef0b54cf808622f5bb0928f00b",
|
strip_prefix = "platforms-da5541f26b7de1dc8e04c075c99df5351742a4a2",
|
||||||
urls = ["https://github.com/bazelbuild/platforms/archive/98939346da932eef0b54cf808622f5bb0928f00b.zip"],
|
urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"], # 2022-05-27
|
||||||
)
|
)
|
||||||
|
@ -32,14 +32,14 @@
|
|||||||
set -euox pipefail
|
set -euox pipefail
|
||||||
|
|
||||||
readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20220217"
|
readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20220217"
|
||||||
readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20210617"
|
readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20220621"
|
||||||
|
|
||||||
if [[ -z ${GTEST_ROOT:-} ]]; then
|
if [[ -z ${GTEST_ROOT:-} ]]; then
|
||||||
GTEST_ROOT="$(realpath $(dirname ${0})/..)"
|
GTEST_ROOT="$(realpath $(dirname ${0})/..)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${STD:-} ]]; then
|
if [[ -z ${STD:-} ]]; then
|
||||||
STD="c++11 c++14 c++17 c++20"
|
STD="c++14 c++17 c++20"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test the CMake build
|
# Test the CMake build
|
||||||
@ -55,7 +55,7 @@ for cc in /usr/local/bin/gcc /opt/llvm/clang/bin/clang; do
|
|||||||
${LINUX_LATEST_CONTAINER} \
|
${LINUX_LATEST_CONTAINER} \
|
||||||
/bin/bash -c "
|
/bin/bash -c "
|
||||||
cmake /src \
|
cmake /src \
|
||||||
-DCMAKE_CXX_STANDARD=11 \
|
-DCMAKE_CXX_STANDARD=14 \
|
||||||
-Dgtest_build_samples=ON \
|
-Dgtest_build_samples=ON \
|
||||||
-Dgtest_build_tests=ON \
|
-Dgtest_build_tests=ON \
|
||||||
-Dgmock_build_tests=ON \
|
-Dgmock_build_tests=ON \
|
||||||
@ -72,12 +72,14 @@ time docker run \
|
|||||||
--workdir="/src" \
|
--workdir="/src" \
|
||||||
--rm \
|
--rm \
|
||||||
--env="CC=/usr/local/bin/gcc" \
|
--env="CC=/usr/local/bin/gcc" \
|
||||||
|
--env="BAZEL_CXXOPTS=-std=c++14" \
|
||||||
${LINUX_GCC_FLOOR_CONTAINER} \
|
${LINUX_GCC_FLOOR_CONTAINER} \
|
||||||
/usr/local/bin/bazel test ... \
|
/usr/local/bin/bazel test ... \
|
||||||
--copt="-Wall" \
|
--copt="-Wall" \
|
||||||
--copt="-Werror" \
|
--copt="-Werror" \
|
||||||
--copt="-Wuninitialized" \
|
--copt="-Wuninitialized" \
|
||||||
--copt="-Wno-error=pragmas" \
|
--copt="-Wno-error=pragmas" \
|
||||||
|
--distdir="/bazel-distdir" \
|
||||||
--keep_going \
|
--keep_going \
|
||||||
--show_timestamps \
|
--show_timestamps \
|
||||||
--test_output=errors
|
--test_output=errors
|
||||||
|
@ -40,7 +40,7 @@ for cmake_off_on in OFF ON; do
|
|||||||
BUILD_DIR=$(mktemp -d build_dir.XXXXXXXX)
|
BUILD_DIR=$(mktemp -d build_dir.XXXXXXXX)
|
||||||
cd ${BUILD_DIR}
|
cd ${BUILD_DIR}
|
||||||
time cmake ${GTEST_ROOT} \
|
time cmake ${GTEST_ROOT} \
|
||||||
-DCMAKE_CXX_STANDARD=11 \
|
-DCMAKE_CXX_STANDARD=14 \
|
||||||
-Dgtest_build_samples=ON \
|
-Dgtest_build_samples=ON \
|
||||||
-Dgtest_build_tests=ON \
|
-Dgtest_build_tests=ON \
|
||||||
-Dgmock_build_tests=ON \
|
-Dgmock_build_tests=ON \
|
||||||
@ -53,7 +53,7 @@ done
|
|||||||
# Test the Bazel build
|
# Test the Bazel build
|
||||||
|
|
||||||
# If we are running on Kokoro, check for a versioned Bazel binary.
|
# If we are running on Kokoro, check for a versioned Bazel binary.
|
||||||
KOKORO_GFILE_BAZEL_BIN="bazel-3.7.0-darwin-x86_64"
|
KOKORO_GFILE_BAZEL_BIN="bazel-5.1.1-darwin-x86_64"
|
||||||
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then
|
if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then
|
||||||
BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}"
|
BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}"
|
||||||
chmod +x ${BAZEL_BIN}
|
chmod +x ${BAZEL_BIN}
|
||||||
@ -66,6 +66,7 @@ for absl in 0 1; do
|
|||||||
${BAZEL_BIN} test ... \
|
${BAZEL_BIN} test ... \
|
||||||
--copt="-Wall" \
|
--copt="-Wall" \
|
||||||
--copt="-Werror" \
|
--copt="-Werror" \
|
||||||
|
--cxxopt="-std=c++14" \
|
||||||
--define="absl=${absl}" \
|
--define="absl=${absl}" \
|
||||||
--keep_going \
|
--keep_going \
|
||||||
--show_timestamps \
|
--show_timestamps \
|
||||||
|
@ -392,8 +392,7 @@ Old macros and their new equivalents:
|
|||||||
If a mock method has no `EXPECT_CALL` spec but is called, we say that it's an
|
If a mock method has no `EXPECT_CALL` spec but is called, we say that it's an
|
||||||
"uninteresting call", and the default action (which can be specified using
|
"uninteresting call", and the default action (which can be specified using
|
||||||
`ON_CALL()`) of the method will be taken. Currently, an uninteresting call will
|
`ON_CALL()`) of the method will be taken. Currently, an uninteresting call will
|
||||||
also by default cause gMock to print a warning. (In the future, we might remove
|
also by default cause gMock to print a warning.
|
||||||
this warning by default.)
|
|
||||||
|
|
||||||
However, sometimes you may want to ignore these uninteresting calls, and
|
However, sometimes you may want to ignore these uninteresting calls, and
|
||||||
sometimes you may want to treat them as errors. gMock lets you make the decision
|
sometimes you may want to treat them as errors. gMock lets you make the decision
|
||||||
|
@ -9,7 +9,7 @@ we recommend this tutorial as a starting point.
|
|||||||
To complete this tutorial, you'll need:
|
To complete this tutorial, you'll need:
|
||||||
|
|
||||||
* A compatible operating system (e.g. Linux, macOS, Windows).
|
* A compatible operating system (e.g. Linux, macOS, Windows).
|
||||||
* A compatible C++ compiler that supports at least C++11.
|
* A compatible C++ compiler that supports at least C++14.
|
||||||
* [Bazel](https://bazel.build/), the preferred build system used by the
|
* [Bazel](https://bazel.build/), the preferred build system used by the
|
||||||
GoogleTest team.
|
GoogleTest team.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ this tutorial as a starting point. If your project uses Bazel, see the
|
|||||||
To complete this tutorial, you'll need:
|
To complete this tutorial, you'll need:
|
||||||
|
|
||||||
* A compatible operating system (e.g. Linux, macOS, Windows).
|
* A compatible operating system (e.g. Linux, macOS, Windows).
|
||||||
* A compatible C++ compiler that supports at least C++11.
|
* A compatible C++ compiler that supports at least C++14.
|
||||||
* [CMake](https://cmake.org/) and a compatible build tool for building the
|
* [CMake](https://cmake.org/) and a compatible build tool for building the
|
||||||
project.
|
project.
|
||||||
* Compatible build tools include
|
* Compatible build tools include
|
||||||
@ -52,13 +52,14 @@ To do this, in your project directory (`my_project`), create a file named
|
|||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
project(my_project)
|
project(my_project)
|
||||||
|
|
||||||
# GoogleTest requires at least C++11
|
# GoogleTest requires at least C++14
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
googletest
|
googletest
|
||||||
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
|
GIT_TAG release-1.12.1
|
||||||
)
|
)
|
||||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
@ -108,7 +109,7 @@ add_executable(
|
|||||||
)
|
)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
hello_test
|
hello_test
|
||||||
gtest_main
|
GTest::gtest_main
|
||||||
)
|
)
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
|
@ -3235,6 +3235,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<16>, char) {
|
|||||||
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] = t;
|
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] = t;
|
||||||
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p);
|
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p);
|
||||||
}
|
}
|
||||||
|
template <typename T>
|
||||||
|
auto UnpackStructImpl(const T& t, MakeIndexSequence<17>, char) {
|
||||||
|
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q] = t;
|
||||||
|
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
|
||||||
|
}
|
||||||
#endif // defined(__cpp_structured_bindings)
|
#endif // defined(__cpp_structured_bindings)
|
||||||
|
|
||||||
template <size_t I, typename T>
|
template <size_t I, typename T>
|
||||||
|
@ -181,7 +181,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
|
|||||||
}
|
}
|
||||||
std::cout << "Stack trace:\n"
|
std::cout << "Stack trace:\n"
|
||||||
<< ::testing::internal::GetCurrentOsStackTraceExceptTop(
|
<< ::testing::internal::GetCurrentOsStackTraceExceptTop(
|
||||||
::testing::UnitTest::GetInstance(), actual_to_skip);
|
actual_to_skip);
|
||||||
}
|
}
|
||||||
std::cout << ::std::flush;
|
std::cout << ::std::flush;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
|
|||||||
return expectations_met;
|
return expectations_met;
|
||||||
}
|
}
|
||||||
|
|
||||||
CallReaction intToCallReaction(int mock_behavior) {
|
static CallReaction intToCallReaction(int mock_behavior) {
|
||||||
if (mock_behavior >= kAllow && mock_behavior <= kFail) {
|
if (mock_behavior >= kAllow && mock_behavior <= kFail) {
|
||||||
return static_cast<internal::CallReaction>(mock_behavior);
|
return static_cast<internal::CallReaction>(mock_behavior);
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ TEST(DefaultValueOfReferenceTest, IsInitiallyUnset) {
|
|||||||
EXPECT_FALSE(DefaultValue<MyNonDefaultConstructible&>::IsSet());
|
EXPECT_FALSE(DefaultValue<MyNonDefaultConstructible&>::IsSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that DefaultValue<T&>::Exists is false initiallly.
|
// Tests that DefaultValue<T&>::Exists is false initially.
|
||||||
TEST(DefaultValueOfReferenceTest, IsInitiallyNotExisting) {
|
TEST(DefaultValueOfReferenceTest, IsInitiallyNotExisting) {
|
||||||
EXPECT_FALSE(DefaultValue<int&>::Exists());
|
EXPECT_FALSE(DefaultValue<int&>::Exists());
|
||||||
EXPECT_FALSE(DefaultValue<MyDefaultConstructible&>::Exists());
|
EXPECT_FALSE(DefaultValue<MyDefaultConstructible&>::Exists());
|
||||||
@ -807,7 +807,7 @@ TEST(ReturnTest, MoveOnlyResultType) {
|
|||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that Return(v) is covaraint.
|
// Tests that Return(v) is covariant.
|
||||||
|
|
||||||
struct Base {
|
struct Base {
|
||||||
bool operator==(const Base&) { return true; }
|
bool operator==(const Base&) { return true; }
|
||||||
|
@ -1561,7 +1561,7 @@ TEST(AnyOfArrayTest, Matchers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(AnyOfArrayTestP, ExplainsMatchResultCorrectly) {
|
TEST_P(AnyOfArrayTestP, ExplainsMatchResultCorrectly) {
|
||||||
// AnyOfArray and AllOfArry use the same underlying template-template,
|
// AnyOfArray and AllOfArray use the same underlying template-template,
|
||||||
// thus it is sufficient to test one here.
|
// thus it is sufficient to test one here.
|
||||||
const std::vector<int> v0{};
|
const std::vector<int> v0{};
|
||||||
const std::vector<int> v1{1};
|
const std::vector<int> v1{1};
|
||||||
|
@ -1064,7 +1064,7 @@ TEST(UnexpectedCallTest, UnmatchedArguments) {
|
|||||||
|
|
||||||
// Tests that Google Mock explains that an expectation with
|
// Tests that Google Mock explains that an expectation with
|
||||||
// unsatisfied pre-requisites doesn't match the call.
|
// unsatisfied pre-requisites doesn't match the call.
|
||||||
TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
|
TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) {
|
||||||
Sequence s1, s2;
|
Sequence s1, s2;
|
||||||
MockB b;
|
MockB b;
|
||||||
EXPECT_CALL(b, DoB(1)).InSequence(s1);
|
EXPECT_CALL(b, DoB(1)).InSequence(s1);
|
||||||
|
@ -25,7 +25,7 @@ When building GoogleTest as a standalone project, the typical workflow starts
|
|||||||
with
|
with
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/google/googletest.git -b release-1.11.0
|
git clone https://github.com/google/googletest.git -b release-1.12.0
|
||||||
cd googletest # Main directory of the cloned repository.
|
cd googletest # Main directory of the cloned repository.
|
||||||
mkdir build # Create a directory to hold the build output.
|
mkdir build # Create a directory to hold the build output.
|
||||||
cd build
|
cd build
|
||||||
@ -94,7 +94,7 @@ include(FetchContent)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
googletest
|
googletest
|
||||||
# Specify the commit you depend on and update it regularly.
|
# Specify the commit you depend on and update it regularly.
|
||||||
URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip
|
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
|
||||||
)
|
)
|
||||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
|
@ -82,7 +82,9 @@ macro(config_compiler_and_linker)
|
|||||||
# http://stackoverflow.com/questions/3232669 explains the issue.
|
# http://stackoverflow.com/questions/3232669 explains the issue.
|
||||||
set(cxx_base_flags "${cxx_base_flags} -wd4702")
|
set(cxx_base_flags "${cxx_base_flags} -wd4702")
|
||||||
# Ensure MSVC treats source files as UTF-8 encoded.
|
# Ensure MSVC treats source files as UTF-8 encoded.
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
set(cxx_base_flags "${cxx_base_flags} -utf-8")
|
set(cxx_base_flags "${cxx_base_flags} -utf-8")
|
||||||
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
set(cxx_base_flags "-Wall -Wshadow -Wconversion")
|
set(cxx_base_flags "-Wall -Wshadow -Wconversion")
|
||||||
set(cxx_exception_flags "-fexceptions")
|
set(cxx_exception_flags "-fexceptions")
|
||||||
@ -160,7 +162,8 @@ function(cxx_library_with_type name type cxx_flags)
|
|||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
||||||
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
# make PDBs match library name
|
# make PDBs match library name
|
||||||
get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX)
|
get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX)
|
||||||
set_target_properties(${name}
|
set_target_properties(${name}
|
||||||
@ -189,7 +192,7 @@ function(cxx_library_with_type name type cxx_flags)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
|
if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
|
||||||
target_compile_features(${name} PUBLIC cxx_std_11)
|
target_compile_features(${name} PUBLIC cxx_std_14)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -242,6 +245,12 @@ function(cxx_executable name dir libs)
|
|||||||
${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN})
|
${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# CMP0094 policy enables finding a Python executable in the LOCATION order, as
|
||||||
|
# specified by the PATH environment variable.
|
||||||
|
if (POLICY CMP0094)
|
||||||
|
cmake_policy(SET CMP0094 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
|
# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
|
||||||
if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0")
|
if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0")
|
||||||
find_package(PythonInterp)
|
find_package(PythonInterp)
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
#include "gtest/gtest-message.h"
|
#include "gtest/gtest-message.h"
|
||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// A class for indicating whether an assertion was successful. When
|
// A class for indicating whether an assertion was successful. When
|
||||||
@ -229,4 +232,6 @@ GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
|
|||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_ASSERTION_RESULT_H_
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -461,7 +462,7 @@ class TestFactoryBase {
|
|||||||
TestFactoryBase& operator=(const TestFactoryBase&) = delete;
|
TestFactoryBase& operator=(const TestFactoryBase&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This class provides implementation of TeastFactoryBase interface.
|
// This class provides implementation of TestFactoryBase interface.
|
||||||
// It is used in TEST and TEST_F macros.
|
// It is used in TEST and TEST_F macros.
|
||||||
template <class TestClass>
|
template <class TestClass>
|
||||||
class TestFactoryImpl : public TestFactoryBase {
|
class TestFactoryImpl : public TestFactoryBase {
|
||||||
@ -631,7 +632,7 @@ class GTEST_API_ TypedTestSuitePState {
|
|||||||
const char* registered_tests);
|
const char* registered_tests);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
|
typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
|
||||||
|
|
||||||
bool registered_;
|
bool registered_;
|
||||||
RegisteredTestsMap registered_tests_;
|
RegisteredTestsMap registered_tests_;
|
||||||
@ -829,8 +830,7 @@ class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
|
|||||||
// For example, if Foo() calls Bar(), which in turn calls
|
// For example, if Foo() calls Bar(), which in turn calls
|
||||||
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
|
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
|
||||||
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
|
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
|
||||||
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
|
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count);
|
||||||
int skip_count);
|
|
||||||
|
|
||||||
// Helpers for suppressing warnings on unreachable code or constant
|
// Helpers for suppressing warnings on unreachable code or constant
|
||||||
// condition.
|
// condition.
|
||||||
|
@ -1200,6 +1200,9 @@ class GTEST_API_ AutoHandle {
|
|||||||
// Nothing to do here.
|
// Nothing to do here.
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
// Allows a controller thread to pause execution of newly created
|
// Allows a controller thread to pause execution of newly created
|
||||||
// threads until notified. Instances of this class must be created
|
// threads until notified. Instances of this class must be created
|
||||||
// and destroyed in the controller thread.
|
// and destroyed in the controller thread.
|
||||||
@ -1233,6 +1236,7 @@ class GTEST_API_ Notification {
|
|||||||
std::condition_variable cv_;
|
std::condition_variable cv_;
|
||||||
bool notified_;
|
bool notified_;
|
||||||
};
|
};
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
#endif // GTEST_HAS_NOTIFICATION_
|
#endif // GTEST_HAS_NOTIFICATION_
|
||||||
|
|
||||||
// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
|
// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
|
||||||
@ -1706,7 +1710,7 @@ typedef GTestMutexLock MutexLock;
|
|||||||
// C-linkage. Therefore it cannot be templatized to access
|
// C-linkage. Therefore it cannot be templatized to access
|
||||||
// ThreadLocal<T>. Hence the need for class
|
// ThreadLocal<T>. Hence the need for class
|
||||||
// ThreadLocalValueHolderBase.
|
// ThreadLocalValueHolderBase.
|
||||||
class ThreadLocalValueHolderBase {
|
class GTEST_API_ ThreadLocalValueHolderBase {
|
||||||
public:
|
public:
|
||||||
virtual ~ThreadLocalValueHolderBase() {}
|
virtual ~ThreadLocalValueHolderBase() {}
|
||||||
};
|
};
|
||||||
@ -1965,7 +1969,8 @@ inline int StrCaseCmp(const char* s1, const char* s2) {
|
|||||||
}
|
}
|
||||||
inline char* StrDup(const char* src) { return strdup(src); }
|
inline char* StrDup(const char* src) { return strdup(src); }
|
||||||
#else // !__BORLANDC__
|
#else // !__BORLANDC__
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \
|
||||||
|
GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM)
|
||||||
inline int DoIsATTY(int /* fd */) { return 0; }
|
inline int DoIsATTY(int /* fd */) { return 0; }
|
||||||
#else
|
#else
|
||||||
inline int DoIsATTY(int fd) { return _isatty(fd); }
|
inline int DoIsATTY(int fd) { return _isatty(fd); }
|
||||||
|
@ -507,9 +507,9 @@ class GTEST_API_ UnitTestImpl {
|
|||||||
virtual ~UnitTestImpl();
|
virtual ~UnitTestImpl();
|
||||||
|
|
||||||
// There are two different ways to register your own TestPartResultReporter.
|
// There are two different ways to register your own TestPartResultReporter.
|
||||||
// You can register your own repoter to listen either only for test results
|
// You can register your own reporter to listen either only for test results
|
||||||
// from the current thread or for results from all threads.
|
// from the current thread or for results from all threads.
|
||||||
// By default, each per-thread test result repoter just passes a new
|
// By default, each per-thread test result reporter just passes a new
|
||||||
// TestPartResult to the global test result reporter, which registers the
|
// TestPartResult to the global test result reporter, which registers the
|
||||||
// test part result for the currently running test.
|
// test part result for the currently running test.
|
||||||
|
|
||||||
@ -850,7 +850,7 @@ class GTEST_API_ UnitTestImpl {
|
|||||||
default_per_thread_test_part_result_reporter_;
|
default_per_thread_test_part_result_reporter_;
|
||||||
|
|
||||||
// Points to (but doesn't own) the global test part result reporter.
|
// Points to (but doesn't own) the global test part result reporter.
|
||||||
TestPartResultReporterInterface* global_test_part_result_repoter_;
|
TestPartResultReporterInterface* global_test_part_result_reporter_;
|
||||||
|
|
||||||
// Protects read and write access to global_test_part_result_reporter_.
|
// Protects read and write access to global_test_part_result_reporter_.
|
||||||
internal::Mutex global_test_part_result_reporter_mutex_;
|
internal::Mutex global_test_part_result_reporter_mutex_;
|
||||||
|
@ -90,15 +90,6 @@
|
|||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
||||||
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
|
||||||
const int kStdOutFileno = 1;
|
|
||||||
const int kStdErrFileno = 2;
|
|
||||||
#else
|
|
||||||
const int kStdOutFileno = STDOUT_FILENO;
|
|
||||||
const int kStdErrFileno = STDERR_FILENO;
|
|
||||||
#endif // _MSC_VER
|
|
||||||
|
|
||||||
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
|
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -1177,6 +1168,15 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
||||||
|
const int kStdOutFileno = 1;
|
||||||
|
const int kStdErrFileno = 2;
|
||||||
|
#else
|
||||||
|
const int kStdOutFileno = STDOUT_FILENO;
|
||||||
|
const int kStdErrFileno = STDERR_FILENO;
|
||||||
|
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
|
||||||
// Starts capturing stdout.
|
// Starts capturing stdout.
|
||||||
void CaptureStdout() {
|
void CaptureStdout() {
|
||||||
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
|
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
|
||||||
|
@ -372,6 +372,8 @@ GTEST_DEFINE_string_(
|
|||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
const uint32_t Random::kMaxRange;
|
||||||
|
|
||||||
// Generates a random number from [0, range), using a Linear
|
// Generates a random number from [0, range), using a Linear
|
||||||
// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
|
// Congruential Generator (LCG). Crashes if 'range' is 0 or greater
|
||||||
// than kMaxRange.
|
// than kMaxRange.
|
||||||
@ -1008,14 +1010,14 @@ void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
|
|||||||
TestPartResultReporterInterface*
|
TestPartResultReporterInterface*
|
||||||
UnitTestImpl::GetGlobalTestPartResultReporter() {
|
UnitTestImpl::GetGlobalTestPartResultReporter() {
|
||||||
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
|
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
|
||||||
return global_test_part_result_repoter_;
|
return global_test_part_result_reporter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the global test part result reporter.
|
// Sets the global test part result reporter.
|
||||||
void UnitTestImpl::SetGlobalTestPartResultReporter(
|
void UnitTestImpl::SetGlobalTestPartResultReporter(
|
||||||
TestPartResultReporterInterface* reporter) {
|
TestPartResultReporterInterface* reporter) {
|
||||||
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
|
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
|
||||||
global_test_part_result_repoter_ = reporter;
|
global_test_part_result_reporter_ = reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the test part result reporter for the current thread.
|
// Returns the test part result reporter for the current thread.
|
||||||
@ -3280,14 +3282,9 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \
|
|
||||||
GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM)
|
|
||||||
const bool use_color = AlwaysFalse();
|
|
||||||
#else
|
|
||||||
static const bool in_color_mode =
|
static const bool in_color_mode =
|
||||||
ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
|
ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
|
||||||
const bool use_color = in_color_mode && (color != GTestColor::kDefault);
|
const bool use_color = in_color_mode && (color != GTestColor::kDefault);
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS
|
|
||||||
|
|
||||||
if (!use_color) {
|
if (!use_color) {
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
@ -5535,7 +5532,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
|||||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */)
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */)
|
||||||
default_global_test_part_result_reporter_(this),
|
default_global_test_part_result_reporter_(this),
|
||||||
default_per_thread_test_part_result_reporter_(this),
|
default_per_thread_test_part_result_reporter_(this),
|
||||||
GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_repoter_(
|
GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_reporter_(
|
||||||
&default_global_test_part_result_reporter_),
|
&default_global_test_part_result_reporter_),
|
||||||
per_thread_test_part_result_reporter_(
|
per_thread_test_part_result_reporter_(
|
||||||
&default_per_thread_test_part_result_reporter_),
|
&default_per_thread_test_part_result_reporter_),
|
||||||
@ -6264,7 +6261,7 @@ void UnitTestImpl::UnshuffleTests() {
|
|||||||
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
|
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
|
||||||
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
|
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
|
||||||
GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_ std::string
|
GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_ std::string
|
||||||
GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, int skip_count) {
|
GetCurrentOsStackTraceExceptTop(int skip_count) {
|
||||||
// We pass skip_count + 1 to skip this wrapper function in addition
|
// We pass skip_count + 1 to skip this wrapper function in addition
|
||||||
// to what the user really wants to skip.
|
// to what the user really wants to skip.
|
||||||
return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
|
return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
|
||||||
|
@ -821,7 +821,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
|
|||||||
TEST(MacroNameing, LookupNames) {
|
TEST(MacroNameing, LookupNames) {
|
||||||
std::set<std::string> know_suite_names, know_test_names;
|
std::set<std::string> know_suite_names, know_test_names;
|
||||||
|
|
||||||
auto ins = testing::UnitTest::GetInstance();
|
const auto& ins = testing::UnitTest::GetInstance();
|
||||||
int ts = 0;
|
int ts = 0;
|
||||||
while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) {
|
while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) {
|
||||||
know_suite_names.insert(suite->name());
|
know_suite_names.insert(suite->name());
|
||||||
@ -897,7 +897,7 @@ INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest,
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST(CustomNamingTest, CheckNameRegistry) {
|
TEST(CustomNamingTest, CheckNameRegistry) {
|
||||||
::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance();
|
const auto& unit_test = ::testing::UnitTest::GetInstance();
|
||||||
std::set<std::string> test_names;
|
std::set<std::string> test_names;
|
||||||
for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
|
for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
|
||||||
++suite_num) {
|
++suite_num) {
|
||||||
|
@ -106,7 +106,7 @@ const int kTypedTests = 1;
|
|||||||
// Since tests can be run in any order, the values the accessors that track
|
// Since tests can be run in any order, the values the accessors that track
|
||||||
// test execution (such as failed_test_count) can not be predicted.
|
// test execution (such as failed_test_count) can not be predicted.
|
||||||
TEST(ApiTest, UnitTestImmutableAccessorsWork) {
|
TEST(ApiTest, UnitTestImmutableAccessorsWork) {
|
||||||
UnitTest* unit_test = UnitTest::GetInstance();
|
const auto& unit_test = UnitTest::GetInstance();
|
||||||
|
|
||||||
ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count());
|
ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count());
|
||||||
EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count());
|
EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count());
|
||||||
@ -224,7 +224,7 @@ TEST(DISABLED_Test, Dummy2) {}
|
|||||||
class FinalSuccessChecker : public Environment {
|
class FinalSuccessChecker : public Environment {
|
||||||
protected:
|
protected:
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
UnitTest* unit_test = UnitTest::GetInstance();
|
const auto& unit_test = UnitTest::GetInstance();
|
||||||
|
|
||||||
EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count());
|
EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count());
|
||||||
EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());
|
EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());
|
||||||
|
@ -7724,7 +7724,7 @@ auto* dynamic_test = testing::RegisterTest(
|
|||||||
__LINE__, []() -> DynamicUnitTestFixture* { return new DynamicTest; });
|
__LINE__, []() -> DynamicUnitTestFixture* { return new DynamicTest; });
|
||||||
|
|
||||||
TEST(RegisterTest, WasRegistered) {
|
TEST(RegisterTest, WasRegistered) {
|
||||||
auto* unittest = testing::UnitTest::GetInstance();
|
const auto& unittest = testing::UnitTest::GetInstance();
|
||||||
for (int i = 0; i < unittest->total_test_suite_count(); ++i) {
|
for (int i = 0; i < unittest->total_test_suite_count(); ++i) {
|
||||||
auto* tests = unittest->GetTestSuite(i);
|
auto* tests = unittest->GetTestSuite(i);
|
||||||
if (tests->name() != std::string("DynamicUnitTestFixture")) continue;
|
if (tests->name() != std::string("DynamicUnitTestFixture")) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user