"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googletest/test/googletest-test-part-test.cc" between
googletest-release-1.11.0.tar.gz and googletest-release-1.12.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

googletest-test-part-test.cc  (googletest-release-1.11.0):googletest-test-part-test.cc  (googletest-release-1.12.0)
skipping to change at line 31 skipping to change at line 31
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest-test-part.h" #include "gtest/gtest-test-part.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using testing::Message; using testing::Message;
using testing::Test; using testing::Test;
using testing::TestPartResult; using testing::TestPartResult;
using testing::TestPartResultArray; using testing::TestPartResultArray;
namespace { namespace {
// Tests the TestPartResult class. // Tests the TestPartResult class.
skipping to change at line 61 skipping to change at line 60
TestPartResult r1_, r2_, r3_, r4_; TestPartResult r1_, r2_, r3_, r4_;
}; };
TEST_F(TestPartResultTest, ConstructorWorks) { TEST_F(TestPartResultTest, ConstructorWorks) {
Message message; Message message;
message << "something is terribly wrong"; message << "something is terribly wrong";
message << static_cast<const char*>(testing::internal::kStackTraceMarker); message << static_cast<const char*>(testing::internal::kStackTraceMarker);
message << "some unimportant stack trace"; message << "some unimportant stack trace";
const TestPartResult result(TestPartResult::kNonFatalFailure, const TestPartResult result(TestPartResult::kNonFatalFailure, "some_file.cc",
"some_file.cc", 42, message.GetString().c_str());
42,
message.GetString().c_str());
EXPECT_EQ(TestPartResult::kNonFatalFailure, result.type()); EXPECT_EQ(TestPartResult::kNonFatalFailure, result.type());
EXPECT_STREQ("some_file.cc", result.file_name()); EXPECT_STREQ("some_file.cc", result.file_name());
EXPECT_EQ(42, result.line_number()); EXPECT_EQ(42, result.line_number());
EXPECT_STREQ(message.GetString().c_str(), result.message()); EXPECT_STREQ(message.GetString().c_str(), result.message());
EXPECT_STREQ("something is terribly wrong", result.summary()); EXPECT_STREQ("something is terribly wrong", result.summary());
} }
TEST_F(TestPartResultTest, ResultAccessorsWork) { TEST_F(TestPartResultTest, ResultAccessorsWork) {
const TestPartResult success(TestPartResult::kSuccess, const TestPartResult success(TestPartResult::kSuccess, "file.cc", 42,
"file.cc",
42,
"message"); "message");
EXPECT_TRUE(success.passed()); EXPECT_TRUE(success.passed());
EXPECT_FALSE(success.failed()); EXPECT_FALSE(success.failed());
EXPECT_FALSE(success.nonfatally_failed()); EXPECT_FALSE(success.nonfatally_failed());
EXPECT_FALSE(success.fatally_failed()); EXPECT_FALSE(success.fatally_failed());
EXPECT_FALSE(success.skipped()); EXPECT_FALSE(success.skipped());
const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure, const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure,
"file.cc", "file.cc", 42, "message");
42,
"message");
EXPECT_FALSE(nonfatal_failure.passed()); EXPECT_FALSE(nonfatal_failure.passed());
EXPECT_TRUE(nonfatal_failure.failed()); EXPECT_TRUE(nonfatal_failure.failed());
EXPECT_TRUE(nonfatal_failure.nonfatally_failed()); EXPECT_TRUE(nonfatal_failure.nonfatally_failed());
EXPECT_FALSE(nonfatal_failure.fatally_failed()); EXPECT_FALSE(nonfatal_failure.fatally_failed());
EXPECT_FALSE(nonfatal_failure.skipped()); EXPECT_FALSE(nonfatal_failure.skipped());
const TestPartResult fatal_failure(TestPartResult::kFatalFailure, const TestPartResult fatal_failure(TestPartResult::kFatalFailure, "file.cc",
"file.cc", 42, "message");
42,
"message");
EXPECT_FALSE(fatal_failure.passed()); EXPECT_FALSE(fatal_failure.passed());
EXPECT_TRUE(fatal_failure.failed()); EXPECT_TRUE(fatal_failure.failed());
EXPECT_FALSE(fatal_failure.nonfatally_failed()); EXPECT_FALSE(fatal_failure.nonfatally_failed());
EXPECT_TRUE(fatal_failure.fatally_failed()); EXPECT_TRUE(fatal_failure.fatally_failed());
EXPECT_FALSE(fatal_failure.skipped()); EXPECT_FALSE(fatal_failure.skipped());
const TestPartResult skip(TestPartResult::kSkip, "file.cc", 42, "message"); const TestPartResult skip(TestPartResult::kSkip, "file.cc", 42, "message");
EXPECT_FALSE(skip.passed()); EXPECT_FALSE(skip.passed());
EXPECT_FALSE(skip.failed()); EXPECT_FALSE(skip.failed());
EXPECT_FALSE(skip.nonfatally_failed()); EXPECT_FALSE(skip.nonfatally_failed());
 End of changes. 5 change blocks. 
15 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)