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
0809c680
Unverified
Commit
0809c680
authored
Sep 25, 2018
by
Gennadiy Civil
Committed by
GitHub
Sep 25, 2018
Browse files
Merge pull request #1862 from google/9A681768AABE08D1EFA5CA77528236A4
Googletest export (and revert #1850)
parents
70ed5e5c
220e790a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
645 deletions
+62
-645
.travis.yml
.travis.yml
+1
-1
appveyor.yml
appveyor.yml
+1
-6
googlemock/include/gmock/gmock-generated-matchers.h
googlemock/include/gmock/gmock-generated-matchers.h
+0
-446
googlemock/include/gmock/gmock-generated-matchers.h.pump
googlemock/include/gmock/gmock-generated-matchers.h.pump
+0
-69
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+17
-17
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+39
-66
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+4
-40
No files found.
.travis.yml
View file @
0809c680
...
...
@@ -25,7 +25,7 @@ matrix:
compiler
:
gcc
install
:
./ci/install-linux.sh && ./ci/log-config.sh
script
:
./ci/build-linux-autotools.sh
env
:
VERBOSE=1 CXX
_
FLAGS=-std=c++11
env
:
VERBOSE=1 CXXFLAGS=-std=c++11
-
os
:
linux
group
:
deprecated-2017Q4
compiler
:
gcc
...
...
appveyor.yml
View file @
0809c680
...
...
@@ -20,12 +20,6 @@ environment:
-
compiler
:
msvc-14-seh
generator
:
"
Visual
Studio
14
2015
Win64"
-
compiler
:
gcc-5.3.0-posix
generator
:
"
MinGW
Makefiles"
cxx_path
:
'
C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin'
cxx_options
:
"
-std=gnu++11"
enabled_on_pr
:
yes
-
compiler
:
gcc-6.3.0-posix
generator
:
"
MinGW
Makefiles"
cxx_path
:
'
C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
...
...
@@ -41,6 +35,7 @@ install:
Write-Output "Compiler: $env:compiler"
Write-Output "Generator: $env:generator"
Write-Output "Env:Configuation: $env:configuration"
Write-Output "Env: $env"
if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
Write-Output "This is *NOT* a pull request build"
} else {
...
...
googlemock/include/gmock/gmock-generated-matchers.h
View file @
0809c680
...
...
@@ -553,452 +553,6 @@ Args(const InnerMatcher& matcher) {
k9
,
k10
>
(
matcher
);
}
// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
// n elements, where the i-th element in the container must
// match the i-th argument in the list. Each argument of
// ElementsAre() can be either a value or a matcher. We support up to
// 10 arguments.
//
// The use of DecayArray in the implementation allows ElementsAre()
// to accept string literals, whose type is const char[N], but we
// want to treat them as const char*.
//
// NOTE: Since ElementsAre() cares about the order of the elements, it
// must not be used with containers whose elements's order is
// undefined (e.g. hash_map).
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<>
>
ElementsAre
()
{
typedef
::
testing
::
tuple
<>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
());
}
template
<
typename
T1
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
>
>
ElementsAre
(
const
T1
&
e1
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
));
}
template
<
typename
T1
,
typename
T2
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
,
const
T8
&
e8
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
,
e8
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
,
const
T8
&
e8
,
const
T9
&
e9
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
,
e8
,
e9
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
,
typename
T10
>
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
,
typename
internal
::
DecayArray
<
T10
>::
type
>
>
ElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
,
const
T8
&
e8
,
const
T9
&
e9
,
const
T10
&
e10
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
,
typename
internal
::
DecayArray
<
T10
>::
type
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
,
e8
,
e9
,
e10
));
}
// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
// that matches n elements in any order. We support up to n=10 arguments.
//
// If you have >10 elements, consider UnorderedElementsAreArray() or
// UnorderedPointwise() instead.
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<>
>
UnorderedElementsAre
()
{
typedef
::
testing
::
tuple
<>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
());
}
template
<
typename
T1
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
));
}
template
<
typename
T1
,
typename
T2
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
,
const
T8
&
e8
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
,
e8
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
,
const
T8
&
e8
,
const
T9
&
e9
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
,
e8
,
e9
));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
,
typename
T5
,
typename
T6
,
typename
T7
,
typename
T8
,
typename
T9
,
typename
T10
>
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
,
typename
internal
::
DecayArray
<
T10
>::
type
>
>
UnorderedElementsAre
(
const
T1
&
e1
,
const
T2
&
e2
,
const
T3
&
e3
,
const
T4
&
e4
,
const
T5
&
e5
,
const
T6
&
e6
,
const
T7
&
e7
,
const
T8
&
e8
,
const
T9
&
e9
,
const
T10
&
e10
)
{
typedef
::
testing
::
tuple
<
typename
internal
::
DecayArray
<
T1
>::
type
,
typename
internal
::
DecayArray
<
T2
>::
type
,
typename
internal
::
DecayArray
<
T3
>::
type
,
typename
internal
::
DecayArray
<
T4
>::
type
,
typename
internal
::
DecayArray
<
T5
>::
type
,
typename
internal
::
DecayArray
<
T6
>::
type
,
typename
internal
::
DecayArray
<
T7
>::
type
,
typename
internal
::
DecayArray
<
T8
>::
type
,
typename
internal
::
DecayArray
<
T9
>::
type
,
typename
internal
::
DecayArray
<
T10
>::
type
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
,
e8
,
e9
,
e10
));
}
// AllOf(m1, m2, ..., mk) matches any value that matches all of the given
// sub-matchers. AllOf is called fully qualified to prevent ADL from firing.
...
...
googlemock/include/gmock/gmock-generated-matchers.h.pump
View file @
0809c680
...
...
@@ -263,75 +263,6 @@ Args(const InnerMatcher& matcher) {
}
]]
// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with
// n elements, where the i-th element in the container must
// match the i-th argument in the list. Each argument of
// ElementsAre() can be either a value or a matcher. We support up to
// $n arguments.
//
// The use of DecayArray in the implementation allows ElementsAre()
// to accept string literals, whose type is const char[N], but we
// want to treat them as const char*.
//
// NOTE: Since ElementsAre() cares about the order of the elements, it
// must not be used with containers whose elements's order is
// undefined (e.g. hash_map).
$
range
i
0.
.
n
$
for
i
[[
$
range
j
1.
.
i
$
if
i
>
0
[[
template
<
$
for
j
,
[[
typename
T
$
j
]]>
]]
inline
internal
::
ElementsAreMatcher
<
::
testing
::
tuple
<
$
for
j
,
[[
typename
internal
::
DecayArray
<
T
$
j
[[]]
>::
type
]]
>
>
ElementsAre
(
$
for
j
,
[[
const
T
$
j
&
e
$
j
]])
{
typedef
::
testing
::
tuple
<
$
for
j
,
[[
typename
internal
::
DecayArray
<
T
$
j
[[]]
>::
type
]]
>
Args
;
return
internal
::
ElementsAreMatcher
<
Args
>
(
Args
(
$
for
j
,
[[
e
$
j
]]));
}
]]
// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
// that matches n elements in any order. We support up to n=$n arguments.
//
// If you have >$n elements, consider UnorderedElementsAreArray() or
// UnorderedPointwise() instead.
$
range
i
0.
.
n
$
for
i
[[
$
range
j
1.
.
i
$
if
i
>
0
[[
template
<
$
for
j
,
[[
typename
T
$
j
]]>
]]
inline
internal
::
UnorderedElementsAreMatcher
<
::
testing
::
tuple
<
$
for
j
,
[[
typename
internal
::
DecayArray
<
T
$
j
[[]]
>::
type
]]
>
>
UnorderedElementsAre
(
$
for
j
,
[[
const
T
$
j
&
e
$
j
]])
{
typedef
::
testing
::
tuple
<
$
for
j
,
[[
typename
internal
::
DecayArray
<
T
$
j
[[]]
>::
type
]]
>
Args
;
return
internal
::
UnorderedElementsAreMatcher
<
Args
>
(
Args
(
$
for
j
,
[[
e
$
j
]]));
}
]]
// AllOf(m1, m2, ..., mk) matches any value that matches all of the given
...
...
googlemock/include/gmock/gmock-matchers.h
View file @
0809c680
...
...
@@ -5170,23 +5170,6 @@ std::string DescribeMatcher(const M& matcher, bool negation = false) {
return
ss
.
str
();
}
#if GTEST_LANG_CXX11
// Define variadic matcher versions. They are overloaded in
// gmock-generated-matchers.h for the cases supported by pre C++11 compilers.
template
<
typename
...
Args
>
internal
::
AllOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
AllOf
(
const
Args
&
...
matchers
)
{
return
internal
::
AllOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
(
matchers
...);
}
template
<
typename
...
Args
>
internal
::
AnyOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
AnyOf
(
const
Args
&
...
matchers
)
{
return
internal
::
AnyOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
(
matchers
...);
}
template
<
typename
...
Args
>
internal
::
ElementsAreMatcher
<
tuple
<
typename
std
::
decay
<
const
Args
&>::
type
...
>>
ElementsAre
(
const
Args
&
...
matchers
)
{
...
...
@@ -5204,6 +5187,23 @@ UnorderedElementsAre(const Args&... matchers) {
make_tuple
(
matchers
...));
}
#if GTEST_LANG_CXX11
// Define variadic matcher versions. They are overloaded in
// gmock-generated-matchers.h for the cases supported by pre C++11 compilers.
template
<
typename
...
Args
>
internal
::
AllOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
AllOf
(
const
Args
&
...
matchers
)
{
return
internal
::
AllOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
(
matchers
...);
}
template
<
typename
...
Args
>
internal
::
AnyOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
AnyOf
(
const
Args
&
...
matchers
)
{
return
internal
::
AnyOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
(
matchers
...);
}
#endif // GTEST_LANG_CXX11
// AllArgs(m) is a synonym of m. This is useful in
...
...
googletest/include/gtest/internal/gtest-internal.h
View file @
0809c680
...
...
@@ -1189,18 +1189,6 @@ class NativeArray {
GTEST_DISALLOW_ASSIGN_
(
NativeArray
);
};
class
AdditionalMessage
{
public:
AdditionalMessage
(
const
char
*
message
)
:
msg
(
message
)
{}
void
set
(
const
std
::
string
&
message
)
{
msg
=
message
;
}
operator
bool
()
const
{
return
true
;
}
const
std
::
string
&
get
()
const
{
return
msg
;
}
private:
std
::
string
msg
;
};
}
// namespace internal
}
// namespace testing
...
...
@@ -1226,60 +1214,45 @@ class AdditionalMessage {
#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
if (::testing::internal::AlwaysTrue()) { statement; }
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AdditionalMessage message = "") { \
bool gtest_caught_expected = false; \
try { \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} catch (expected_exception const&) { \
gtest_caught_expected = true; \
throw; \
} \
} catch (const std::exception& e) { \
if (!gtest_caught_expected) { \
message.set( \
"it throws a different type " \
"with message: " + \
std::string(e.what())); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} catch (...) { \
if (!gtest_caught_expected) { \
message.set("it throws a different type."); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} \
if (!gtest_caught_expected) { \
message.set("it throws nothing."); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__) \
: fail(("Expected: " #statement \
" throws an exception of type " #expected_exception \
".\n Actual: " + \
message.get()) \
.c_str())
#define GTEST_TEST_NO_THROW_(statement, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AdditionalMessage message = ".") { \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} catch (const std::exception& e) { \
message.set(std::string(": ") + e.what()); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
} catch (...) { \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__) \
: fail(("Expected: " #statement " doesn't throw an exception.\n" \
" Actual: it throws" + \
message.get()) \
.c_str())
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::ConstCharPtr gtest_msg = "") { \
bool gtest_caught_expected = false; \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
catch (expected_exception const&) { \
gtest_caught_expected = true; \
} \
catch (...) { \
gtest_msg.value = \
"Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws a different type."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
if (!gtest_caught_expected) { \
gtest_msg.value = \
"Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws nothing."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
fail(gtest_msg.value)
#define GTEST_TEST_NO_THROW_(statement, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::AlwaysTrue()) { \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
catch (...) { \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
fail("Expected: " #statement " doesn't throw an exception.\n" \
" Actual: it throws.")
#define GTEST_TEST_ANY_THROW_(statement, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
...
...
googletest/test/gtest_unittest.cc
View file @
0809c680
...
...
@@ -3328,7 +3328,6 @@ TEST_F(SingleEvaluationTest, OtherCases) {
void
ThrowAnInteger
()
{
throw
1
;
}
void
ThrowAnException
(
const
char
*
what
)
{
throw
std
::
runtime_error
(
what
);
}
// Tests that assertion arguments are evaluated exactly once.
TEST_F
(
SingleEvaluationTest
,
ExceptionTests
)
{
...
...
@@ -3371,26 +3370,6 @@ TEST_F(SingleEvaluationTest, ExceptionTests) {
// failed EXPECT_ANY_THROW
EXPECT_NONFATAL_FAILURE
(
EXPECT_ANY_THROW
(
a_
++
),
"it doesn't"
);
EXPECT_EQ
(
7
,
a_
);
// failed EXPECT_THROW std::exception, throws different
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
{
// NOLINT
a_
++
;
ThrowAnInteger
();
},
std
::
exception
),
"throws a different type"
);
EXPECT_EQ
(
8
,
a_
);
// failed EXPECT_THROW, throws std::exception
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
{
// NOLINT
a_
++
;
ThrowAnException
(
"blablubb"
);
},
bool
),
"throws a different type with message: blablubb"
);
EXPECT_EQ
(
9
,
a_
);
}
#endif // GTEST_HAS_EXCEPTIONS
...
...
@@ -3823,11 +3802,6 @@ TEST(AssertionTest, ASSERT_THROW) {
ASSERT_THROW
(
ThrowNothing
(),
bool
),
"Expected: ThrowNothing() throws an exception of type bool.
\n
"
" Actual: it throws nothing."
);
EXPECT_FATAL_FAILURE
(
ASSERT_THROW
(
ThrowAnException
(
"b"
),
bool
),
"Expected: ThrowAnException(
\"
b
\"
) throws an exception of type bool.
\n
"
" Actual: it throws a different type with message: b"
);
}
// Tests ASSERT_NO_THROW.
...
...
@@ -3836,9 +3810,6 @@ TEST(AssertionTest, ASSERT_NO_THROW) {
EXPECT_FATAL_FAILURE
(
ASSERT_NO_THROW
(
ThrowAnInteger
()),
"Expected: ThrowAnInteger() doesn't throw an exception."
"
\n
Actual: it throws."
);
EXPECT_FATAL_FAILURE
(
ASSERT_NO_THROW
(
ThrowAnException
(
"blablubb"
)),
"Expected: ThrowAnException(
\"
blablubb
\"
) doesn't throw"
" an exception.
\n
Actual: it throws: blablubb"
);
}
// Tests ASSERT_ANY_THROW.
...
...
@@ -4565,17 +4536,13 @@ TEST(ExpectTest, EXPECT_GT) {
// Tests EXPECT_THROW.
TEST
(
ExpectTest
,
EXPECT_THROW
)
{
EXPECT_THROW
(
ThrowAnInteger
(),
int
);
EXPECT_THROW
(
ThrowAnException
(
""
),
std
::
exception
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowAnInteger
(),
bool
),
"Expected: ThrowAnInteger() throws an exception of "
"type bool.
\n
Actual: it throws a different type."
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowNothing
(),
bool
),
"Expected: ThrowNothing() throws an exception of "
"type bool.
\n
Actual: it throws nothing."
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowAnException
(
"buuh"
),
bool
),
"Expected: ThrowAnException(
\"
buuh
\"
) throws an "
"exception of type bool.
\n
Actual: "
"it throws a different type with message: buuh"
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowNothing
(),
bool
),
"Expected: ThrowNothing() throws an exception of type bool.
\n
"
" Actual: it throws nothing."
);
}
// Tests EXPECT_NO_THROW.
...
...
@@ -4584,9 +4551,6 @@ TEST(ExpectTest, EXPECT_NO_THROW) {
EXPECT_NONFATAL_FAILURE
(
EXPECT_NO_THROW
(
ThrowAnInteger
()),
"Expected: ThrowAnInteger() doesn't throw an "
"exception.
\n
Actual: it throws."
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_NO_THROW
(
ThrowAnException
(
"blah"
)),
"Expected: ThrowAnException(
\"
blah
\"
) doesn't "
"throw an exception.
\n
Actual: it throws: blah"
);
}
// Tests EXPECT_ANY_THROW.
...
...
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