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
cca227fe
Commit
cca227fe
authored
Dec 16, 2009
by
zhanyong.wan
Browse files
Moves mis-placed tests.
parent
d56773b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
49 deletions
+49
-49
test/gtest-test-part_test.cc
test/gtest-test-part_test.cc
+49
-0
test/gtest_unittest.cc
test/gtest_unittest.cc
+0
-49
No files found.
test/gtest-test-part_test.cc
View file @
cca227fe
...
...
@@ -34,6 +34,7 @@
#include <gtest/gtest.h>
using
testing
::
Message
;
using
testing
::
Test
;
using
testing
::
TestPartResult
;
using
testing
::
TestPartResultArray
;
...
...
@@ -53,6 +54,54 @@ class TestPartResultTest : public Test {
TestPartResult
r1_
,
r2_
,
r3_
;
};
TEST_F
(
TestPartResultTest
,
ConstructorWorks
)
{
Message
message
;
message
<<
"something is terribly wrong"
;
message
<<
static_cast
<
const
char
*>
(
testing
::
internal
::
kStackTraceMarker
);
message
<<
"some unimportant stack trace"
;
const
TestPartResult
result
(
TestPartResult
::
kNonFatalFailure
,
"some_file.cc"
,
42
,
message
.
GetString
().
c_str
());
EXPECT_EQ
(
TestPartResult
::
kNonFatalFailure
,
result
.
type
());
EXPECT_STREQ
(
"some_file.cc"
,
result
.
file_name
());
EXPECT_EQ
(
42
,
result
.
line_number
());
EXPECT_STREQ
(
message
.
GetString
().
c_str
(),
result
.
message
());
EXPECT_STREQ
(
"something is terribly wrong"
,
result
.
summary
());
}
TEST_F
(
TestPartResultTest
,
ResultAccessorsWork
)
{
const
TestPartResult
success
(
TestPartResult
::
kSuccess
,
"file.cc"
,
42
,
"message"
);
EXPECT_TRUE
(
success
.
passed
());
EXPECT_FALSE
(
success
.
failed
());
EXPECT_FALSE
(
success
.
nonfatally_failed
());
EXPECT_FALSE
(
success
.
fatally_failed
());
const
TestPartResult
nonfatal_failure
(
TestPartResult
::
kNonFatalFailure
,
"file.cc"
,
42
,
"message"
);
EXPECT_FALSE
(
nonfatal_failure
.
passed
());
EXPECT_TRUE
(
nonfatal_failure
.
failed
());
EXPECT_TRUE
(
nonfatal_failure
.
nonfatally_failed
());
EXPECT_FALSE
(
nonfatal_failure
.
fatally_failed
());
const
TestPartResult
fatal_failure
(
TestPartResult
::
kFatalFailure
,
"file.cc"
,
42
,
"message"
);
EXPECT_FALSE
(
fatal_failure
.
passed
());
EXPECT_TRUE
(
fatal_failure
.
failed
());
EXPECT_FALSE
(
fatal_failure
.
nonfatally_failed
());
EXPECT_TRUE
(
fatal_failure
.
fatally_failed
());
}
// Tests TestPartResult::type().
TEST_F
(
TestPartResultTest
,
type
)
{
EXPECT_EQ
(
TestPartResult
::
kSuccess
,
r1_
.
type
());
...
...
test/gtest_unittest.cc
View file @
cca227fe
...
...
@@ -1721,55 +1721,6 @@ TEST(TestPropertyTest, SetValue) {
EXPECT_STREQ
(
"value_2"
,
property
.
value
());
}
// Tests the TestPartResult class.
TEST
(
TestPartResultTest
,
ConstructorWorks
)
{
Message
message
;
message
<<
"something is terribly wrong"
;
message
<<
static_cast
<
const
char
*>
(
testing
::
internal
::
kStackTraceMarker
);
message
<<
"some unimportant stack trace"
;
const
TestPartResult
result
(
TestPartResult
::
kNonFatalFailure
,
"some_file.cc"
,
42
,
message
.
GetString
().
c_str
());
EXPECT_EQ
(
TestPartResult
::
kNonFatalFailure
,
result
.
type
());
EXPECT_STREQ
(
"some_file.cc"
,
result
.
file_name
());
EXPECT_EQ
(
42
,
result
.
line_number
());
EXPECT_STREQ
(
message
.
GetString
().
c_str
(),
result
.
message
());
EXPECT_STREQ
(
"something is terribly wrong"
,
result
.
summary
());
}
TEST
(
TestPartResultTest
,
ResultAccessorsWork
)
{
const
TestPartResult
success
(
TestPartResult
::
kSuccess
,
"file.cc"
,
42
,
"message"
);
EXPECT_TRUE
(
success
.
passed
());
EXPECT_FALSE
(
success
.
failed
());
EXPECT_FALSE
(
success
.
nonfatally_failed
());
EXPECT_FALSE
(
success
.
fatally_failed
());
const
TestPartResult
nonfatal_failure
(
TestPartResult
::
kNonFatalFailure
,
"file.cc"
,
42
,
"message"
);
EXPECT_FALSE
(
nonfatal_failure
.
passed
());
EXPECT_TRUE
(
nonfatal_failure
.
failed
());
EXPECT_TRUE
(
nonfatal_failure
.
nonfatally_failed
());
EXPECT_FALSE
(
nonfatal_failure
.
fatally_failed
());
const
TestPartResult
fatal_failure
(
TestPartResult
::
kFatalFailure
,
"file.cc"
,
42
,
"message"
);
EXPECT_FALSE
(
fatal_failure
.
passed
());
EXPECT_TRUE
(
fatal_failure
.
failed
());
EXPECT_FALSE
(
fatal_failure
.
nonfatally_failed
());
EXPECT_TRUE
(
fatal_failure
.
fatally_failed
());
}
// Tests the TestResult class
// The test fixture for testing TestResult.
...
...
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