mirror of
https://github.com/google/googletest.git
synced 2025-03-09 16:26:03 +00:00
Merge branch 'google:main' into custom_type_combine
This commit is contained in:
commit
56070d8903
2
.github/workflows/gtest-ci.yml
vendored
2
.github/workflows/gtest-ci.yml
vendored
@ -40,4 +40,4 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Tests
|
||||
run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
|
||||
run: bazel test --cxxopt=/std:c++14 --features=external_include_paths --test_output=errors ...
|
||||
|
@ -1424,11 +1424,12 @@ Use `Pair` when comparing maps or other associative containers.
|
||||
{% raw %}
|
||||
|
||||
```cpp
|
||||
using testing::ElementsAre;
|
||||
using testing::Pair;
|
||||
using ::testing::UnorderedElementsAre;
|
||||
using ::testing::Pair;
|
||||
...
|
||||
std::map<string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}};
|
||||
EXPECT_THAT(m, ElementsAre(Pair("a", 1), Pair("b", 2), Pair("c", 3)));
|
||||
absl::flat_hash_map<string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}};
|
||||
EXPECT_THAT(m, UnorderedElementsAre(
|
||||
Pair("a", 1), Pair("b", 2), Pair("c", 3)));
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
@ -1445,8 +1446,8 @@ using testing::Pair;
|
||||
* If the container is passed by pointer instead of by reference, just write
|
||||
`Pointee(ElementsAre*(...))`.
|
||||
* The order of elements *matters* for `ElementsAre*()`. If you are using it
|
||||
with containers whose element order are undefined (e.g. `hash_map`) you
|
||||
should use `WhenSorted` around `ElementsAre`.
|
||||
with containers whose element order are undefined (such as a
|
||||
`std::unordered_map`) you should use `UnorderedElementsAre`.
|
||||
|
||||
### Sharing Matchers
|
||||
|
||||
|
@ -34,8 +34,8 @@
|
||||
// IWYU pragma: private, include "gmock/gmock.h"
|
||||
// IWYU pragma: friend gmock/.*
|
||||
|
||||
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
|
||||
#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
|
||||
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
||||
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
||||
|
||||
#include <type_traits> // IWYU pragma: keep
|
||||
#include <utility> // IWYU pragma: keep
|
||||
@ -511,4 +511,4 @@ using internal::FunctionMocker;
|
||||
#define GMOCK_MOCKER_(arity, constness, Method) \
|
||||
GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
|
||||
|
||||
#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
|
||||
#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
|
||||
|
@ -290,13 +290,6 @@ class WithoutMatchers {
|
||||
// Internal use only: access the singleton instance of WithoutMatchers.
|
||||
GTEST_API_ WithoutMatchers GetWithoutMatchers();
|
||||
|
||||
// Disable MSVC warnings for infinite recursion, since in this case the
|
||||
// recursion is unreachable.
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4717)
|
||||
#endif
|
||||
|
||||
// Invalid<T>() is usable as an expression of type T, but will terminate
|
||||
// the program with an assertion failure if actually run. This is useful
|
||||
// when a value of type T is needed for compilation, but the statement
|
||||
@ -314,10 +307,6 @@ inline T Invalid() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// Given a raw type (i.e. having no top-level reference or const
|
||||
// modifier) RawContainer that's either an STL-style container or a
|
||||
// native array, class StlContainerView<RawContainer> has the
|
||||
|
@ -200,8 +200,9 @@ GTEST_API_ void IllegalDoDefault(const char* file, int line) {
|
||||
|
||||
constexpr char UnBase64Impl(char c, const char* const base64, char carry) {
|
||||
return *base64 == 0 ? static_cast<char>(65)
|
||||
: *base64 == c ? carry
|
||||
: UnBase64Impl(c, base64 + 1, carry + 1);
|
||||
: *base64 == c
|
||||
? carry
|
||||
: UnBase64Impl(c, base64 + 1, static_cast<char>(carry + 1));
|
||||
}
|
||||
|
||||
template <size_t... I>
|
||||
|
@ -315,7 +315,7 @@ void PrintTo(__uint128_t v, ::std::ostream* os) {
|
||||
low = low / 10 + high_mod * 1844674407370955161 + carry / 10;
|
||||
|
||||
char digit = static_cast<char>(carry % 10);
|
||||
*--p = '0' + digit;
|
||||
*--p = static_cast<char>('0' + digit);
|
||||
}
|
||||
*os << p;
|
||||
}
|
||||
|
@ -3245,18 +3245,15 @@ bool ShouldUseColor(bool stdout_is_tty) {
|
||||
#else
|
||||
// On non-Windows platforms, we rely on the TERM variable.
|
||||
const char* const term = posix::GetEnv("TERM");
|
||||
const bool term_supports_color =
|
||||
const bool term_supports_color = term != nullptr && (
|
||||
String::CStringEquals(term, "xterm") ||
|
||||
String::CStringEquals(term, "xterm-color") ||
|
||||
String::CStringEquals(term, "xterm-256color") ||
|
||||
String::CStringEquals(term, "screen") ||
|
||||
String::CStringEquals(term, "screen-256color") ||
|
||||
String::CStringEquals(term, "tmux") ||
|
||||
String::CStringEquals(term, "tmux-256color") ||
|
||||
String::CStringEquals(term, "rxvt-unicode") ||
|
||||
String::CStringEquals(term, "rxvt-unicode-256color") ||
|
||||
String::CStringEquals(term, "linux") ||
|
||||
String::CStringEquals(term, "cygwin");
|
||||
String::CStringEquals(term, "cygwin") ||
|
||||
String::EndsWithCaseInsensitive(term, "-256color"));
|
||||
return stdout_is_tty && term_supports_color;
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user