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
cecea92a
Commit
cecea92a
authored
Sep 23, 2018
by
Jonny007-MKD
Browse files
Rename private member of AdditionalMessage
Shorten lines in unit tests
parent
1cb10b35
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+4
-4
googletest/test/gtest_unittest.cc
googletest/test/gtest_unittest.cc
+15
-14
No files found.
googletest/include/gtest/internal/gtest-internal.h
View file @
cecea92a
...
@@ -1192,14 +1192,14 @@ class NativeArray {
...
@@ -1192,14 +1192,14 @@ class NativeArray {
class
AdditionalMessage
class
AdditionalMessage
{
{
public:
public:
AdditionalMessage
(
const
char
*
message
)
:
value
(
message
)
{}
AdditionalMessage
(
const
char
*
message
)
:
msg
(
message
)
{}
void
set
(
const
std
::
string
&
message
)
{
value
=
message
;
}
void
set
(
const
std
::
string
&
message
)
{
msg
=
message
;
}
operator
bool
()
const
{
return
true
;
}
operator
bool
()
const
{
return
true
;
}
const
std
::
string
&
get
()
const
{
return
value
;
}
const
std
::
string
&
get
()
const
{
return
msg
;
}
private:
private:
std
::
string
value
;
std
::
string
msg
;
};
};
}
// namespace internal
}
// namespace internal
...
...
googletest/test/gtest_unittest.cc
View file @
cecea92a
...
@@ -3821,9 +3821,9 @@ TEST(AssertionTest, ASSERT_THROW) {
...
@@ -3821,9 +3821,9 @@ TEST(AssertionTest, ASSERT_THROW) {
" Actual: it throws nothing."
);
" Actual: it throws nothing."
);
EXPECT_FATAL_FAILURE
(
EXPECT_FATAL_FAILURE
(
ASSERT_THROW
(
ThrowAnException
(
"b
uuh
"
),
bool
),
ASSERT_THROW
(
ThrowAnException
(
"b"
),
bool
),
"Expected: ThrowAnException(
\"
b
uuh
\"
) throws an exception of type bool.
\n
"
"Expected: ThrowAnException(
\"
b
\"
) throws an exception of type bool.
\n
"
" Actual: it throws a different type with message: b
uuh
"
);
" Actual: it throws a different type with message: b"
);
}
}
// Tests ASSERT_NO_THROW.
// Tests ASSERT_NO_THROW.
...
@@ -3833,8 +3833,8 @@ TEST(AssertionTest, ASSERT_NO_THROW) {
...
@@ -3833,8 +3833,8 @@ TEST(AssertionTest, ASSERT_NO_THROW) {
"Expected: ThrowAnInteger() doesn't throw an exception."
"Expected: ThrowAnInteger() doesn't throw an exception."
"
\n
Actual: it throws."
);
"
\n
Actual: it throws."
);
EXPECT_FATAL_FAILURE
(
ASSERT_NO_THROW
(
ThrowAnException
(
"blablubb"
)),
EXPECT_FATAL_FAILURE
(
ASSERT_NO_THROW
(
ThrowAnException
(
"blablubb"
)),
"Expected: ThrowAnException(
\"
blablubb
\"
) doesn't throw
an exception.
"
"Expected: ThrowAnException(
\"
blablubb
\"
) doesn't throw"
"
\n
Actual: it throws: blablubb"
);
"
an exception.
\n
Actual: it throws: blablubb"
);
}
}
// Tests ASSERT_ANY_THROW.
// Tests ASSERT_ANY_THROW.
...
@@ -4563,14 +4563,15 @@ TEST(ExpectTest, EXPECT_THROW) {
...
@@ -4563,14 +4563,15 @@ TEST(ExpectTest, EXPECT_THROW) {
EXPECT_THROW
(
ThrowAnInteger
(),
int
);
EXPECT_THROW
(
ThrowAnInteger
(),
int
);
EXPECT_THROW
(
ThrowAnException
(
""
),
std
::
exception
);
EXPECT_THROW
(
ThrowAnException
(
""
),
std
::
exception
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowAnInteger
(),
bool
),
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowAnInteger
(),
bool
),
"Expected: ThrowAnInteger() throws an exception of
type bool.
\n
"
"Expected: ThrowAnInteger() throws an exception of "
" Actual: it throws a different type."
);
"
type bool.
\n
Actual: it throws a different type."
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowNothing
(),
bool
),
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowNothing
(),
bool
),
"Expected: ThrowNothing() throws an exception of
type bool.
\n
"
"Expected: ThrowNothing() throws an exception of "
" Actual: it throws nothing."
);
"
type bool.
\n
Actual: it throws nothing."
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowAnException
(
"buuh"
),
bool
),
EXPECT_NONFATAL_FAILURE
(
EXPECT_THROW
(
ThrowAnException
(
"buuh"
),
bool
),
"Expected: ThrowAnException(
\"
buuh
\"
) throws an exception of type bool.
\n
"
"Expected: ThrowAnException(
\"
buuh
\"
) throws an "
" Actual: it throws a different type with message: buuh"
);
"exception of type bool.
\n
Actual: "
"it throws a different type with message: buuh"
);
}
}
// Tests EXPECT_NO_THROW.
// Tests EXPECT_NO_THROW.
...
@@ -4579,9 +4580,9 @@ TEST(ExpectTest, EXPECT_NO_THROW) {
...
@@ -4579,9 +4580,9 @@ TEST(ExpectTest, EXPECT_NO_THROW) {
EXPECT_NONFATAL_FAILURE
(
EXPECT_NO_THROW
(
ThrowAnInteger
()),
EXPECT_NONFATAL_FAILURE
(
EXPECT_NO_THROW
(
ThrowAnInteger
()),
"Expected: ThrowAnInteger() doesn't throw an "
"Expected: ThrowAnInteger() doesn't throw an "
"exception.
\n
Actual: it throws."
);
"exception.
\n
Actual: it throws."
);
EXPECT_NONFATAL_FAILURE
(
EXPECT_NO_THROW
(
ThrowAnException
(
"bla
blubb
"
)),
EXPECT_NONFATAL_FAILURE
(
EXPECT_NO_THROW
(
ThrowAnException
(
"bla
h
"
)),
"Expected: ThrowAnException(
\"
bla
blubb
\"
) doesn't
throw an
"
"Expected: ThrowAnException(
\"
bla
h
\"
) doesn't "
"exception.
\n
Actual: it throws: bla
blubb
"
);
"
throw an
exception.
\n
Actual: it throws: bla
h
"
);
}
}
// Tests EXPECT_ANY_THROW.
// 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