Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
f4274520
Commit
f4274520
authored
Apr 24, 2013
by
zhanyong.wan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes EXPECT_THAT typesafe; updates CHANGES for 1.7.0; pulls in gtest r653
parent
061f1d4d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
3 deletions
+34
-3
CHANGES
CHANGES
+21
-1
gmock-matchers.h
include/gmock/gmock-matchers.h
+4
-2
gmock-matchers_test.cc
test/gmock-matchers_test.cc
+9
-0
No files found.
CHANGES
View file @
f4274520
Changes for 1.7.0:
Changes for 1.7.0:
TO BE WRITTEN.
* All new improvements in Google Test 1.7.0.
* New feature: matchers WhenSorted(), WhenSortedBy(), IsEmpty(), and
SizeIs().
* Improvement: Google Mock can now be built as a DLL.
* Improvement: when exceptions are enabled, a mock method with no
default action now throws instead crashing the test.
* Improvement: function return types used in MOCK_METHOD*() macros can
now contain unprotected commas.
* Improvement (potentially breaking): EXPECT_THAT() and ASSERT_THAT()
are now more strict in ensuring that the value type and the matcher
type are compatible, catching potential bugs in tests.
* Improvement: Pointee() now works on an optional<T>.
* Improvement: the ElementsAreArray() matcher can now take a vector or
iterator range as input, and makes a copy of its input elements
before the conversion to a Matcher.
* Bug fix: mock object destruction triggerred by another mock object's
destruction no longer hangs.
* Improvement: Google Mock Doctor works better with newer Clang and
GCC now.
* Compatibility fixes.
* Bug/warning fixes.
Changes for 1.6.0:
Changes for 1.6.0:
...
...
include/gmock/gmock-matchers.h
View file @
f4274520
...
@@ -1613,10 +1613,12 @@ class PredicateFormatterFromMatcher {
...
@@ -1613,10 +1613,12 @@ class PredicateFormatterFromMatcher {
// know which type to instantiate it to until we actually see the
// know which type to instantiate it to until we actually see the
// type of x here.
// type of x here.
//
//
// We write MatcherCast<const T&>(matcher_) instead of
// We write
Safe
MatcherCast<const T&>(matcher_) instead of
// Matcher<const T&>(matcher_), as the latter won't compile when
// Matcher<const T&>(matcher_), as the latter won't compile when
// matcher_ has type Matcher<T> (e.g. An<int>()).
// matcher_ has type Matcher<T> (e.g. An<int>()).
const
Matcher
<
const
T
&>
matcher
=
MatcherCast
<
const
T
&>
(
matcher_
);
// We don't write MatcherCast<const T&> either, as that allows
// potentially unsafe downcasting of the matcher argument.
const
Matcher
<
const
T
&>
matcher
=
SafeMatcherCast
<
const
T
&>
(
matcher_
);
StringMatchResultListener
listener
;
StringMatchResultListener
listener
;
if
(
MatchPrintAndExplain
(
x
,
matcher
,
&
listener
))
if
(
MatchPrintAndExplain
(
x
,
matcher
,
&
listener
))
return
AssertionSuccess
();
return
AssertionSuccess
();
...
...
test/gmock-matchers_test.cc
View file @
f4274520
...
@@ -721,6 +721,15 @@ TEST(ATest, MatchesAnyValue) {
...
@@ -721,6 +721,15 @@ TEST(ATest, MatchesAnyValue) {
EXPECT_TRUE
(
m2
.
Matches
(
b
));
EXPECT_TRUE
(
m2
.
Matches
(
b
));
}
}
TEST
(
ATest
,
WorksForDerivedClass
)
{
Base
base
;
Derived
derived
;
EXPECT_THAT
(
&
base
,
A
<
Base
*>
());
// This shouldn't compile: EXPECT_THAT(&base, A<Derived*>());
EXPECT_THAT
(
&
derived
,
A
<
Base
*>
());
EXPECT_THAT
(
&
derived
,
A
<
Derived
*>
());
}
// Tests that A<T>() describes itself properly.
// Tests that A<T>() describes itself properly.
TEST
(
ATest
,
CanDescribeSelf
)
{
TEST
(
ATest
,
CanDescribeSelf
)
{
EXPECT_EQ
(
"is anything"
,
Describe
(
A
<
bool
>
()));
EXPECT_EQ
(
"is anything"
,
Describe
(
A
<
bool
>
()));
...
...
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