diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-12-16 20:21:27 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-12-16 20:21:27 (GMT) |
commit | cca227fe7548171869021bafc31ffd33515f1fcc (patch) | |
tree | 17e9c13134a378ed7bc232242df954a18603effb /test | |
parent | d56773b492b7b675d5c547baab815289a7815bdd (diff) | |
download | googletest-cca227fe7548171869021bafc31ffd33515f1fcc.zip googletest-cca227fe7548171869021bafc31ffd33515f1fcc.tar.gz googletest-cca227fe7548171869021bafc31ffd33515f1fcc.tar.bz2 |
Moves mis-placed tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/gtest-test-part_test.cc | 49 | ||||
-rw-r--r-- | test/gtest_unittest.cc | 49 |
2 files changed, 49 insertions, 49 deletions
diff --git a/test/gtest-test-part_test.cc b/test/gtest-test-part_test.cc index 403c184..5a3e919 100644 --- a/test/gtest-test-part_test.cc +++ b/test/gtest-test-part_test.cc @@ -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()); diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 5e79c5a..9745f93 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -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. |