Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
56070d89
Unverified
Commit
56070d89
authored
Sep 14, 2022
by
Baruch
Committed by
GitHub
Sep 14, 2022
Browse files
Merge branch 'google:main' into custom_type_combine
parents
dd969ed5
1336c4b6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
31 deletions
+19
-31
.github/workflows/gtest-ci.yml
.github/workflows/gtest-ci.yml
+1
-1
docs/gmock_cook_book.md
docs/gmock_cook_book.md
+7
-6
googlemock/include/gmock/gmock-function-mocker.h
googlemock/include/gmock/gmock-function-mocker.h
+3
-3
googlemock/include/gmock/internal/gmock-internal-utils.h
googlemock/include/gmock/internal/gmock-internal-utils.h
+0
-11
googlemock/src/gmock-internal-utils.cc
googlemock/src/gmock-internal-utils.cc
+4
-3
googletest/src/gtest-printers.cc
googletest/src/gtest-printers.cc
+1
-1
googletest/src/gtest.cc
googletest/src/gtest.cc
+3
-6
No files found.
.github/workflows/gtest-ci.yml
View file @
56070d89
...
...
@@ -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 ...
docs/gmock_cook_book.md
View file @
56070d89
...
...
@@ -1424,11 +1424,12 @@ Use `Pair` when comparing maps or other associative containers.
{% raw %}
```
cpp
using
testing
::
ElementsAre
;
using
testing
::
Pair
;
using
::
testing
::
Unordered
ElementsAre
;
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
`Unordered
ElementsAre`
.
### Sharing Matchers
...
...
googlemock/include/gmock/gmock-function-mocker.h
View file @
56070d89
...
...
@@ -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_
googlemock/include/gmock/internal/gmock-internal-utils.h
View file @
56070d89
...
...
@@ -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
...
...
googlemock/src/gmock-internal-utils.cc
View file @
56070d89
...
...
@@ -199,9 +199,10 @@ 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
);
return
*
base64
==
0
?
static_cast
<
char
>
(
65
)
:
*
base64
==
c
?
carry
:
UnBase64Impl
(
c
,
base64
+
1
,
static_cast
<
char
>
(
carry
+
1
));
}
template
<
size_t
...
I
>
...
...
googletest/src/gtest-printers.cc
View file @
56070d89
...
...
@@ -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
;
}
...
...
googletest/src/gtest.cc
View file @
56070d89
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment