From 34fdf02dd57fc7b92e61eeee2c2e6e031ed14477 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Fri, 27 Jul 2012 10:38:44 -0700 Subject: make the build log test match the indended build log logic As described on https://github.com/martine/ninja/pull/349 , this test shouldn't have been passing. Fixing a Valgrind issue showed that the test was wrong. Thankfully it wasn't a critical issue. The new code verifies that we either succeed or report an error when parsing -- the only behavior we really care about is not crashing. --- src/build_log_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/build_log_test.cc b/src/build_log_test.cc index 9fb42c9..0225684 100644 --- a/src/build_log_test.cc +++ b/src/build_log_test.cc @@ -131,7 +131,7 @@ TEST_F(BuildLogTest, Truncate) { ASSERT_GT(statbuf.st_size, 0); // For all possible truncations of the input file, assert that we don't - // crash or report an error when parsing. + // crash when parsing. for (off_t size = statbuf.st_size; size > 0; --size) { #ifndef _WIN32 ASSERT_EQ(0, truncate(kTestFilename, size)); @@ -143,8 +143,8 @@ TEST_F(BuildLogTest, Truncate) { #endif BuildLog log2; - EXPECT_TRUE(log2.Load(kTestFilename, &err)); - ASSERT_EQ("", err); + err.clear(); + ASSERT_TRUE(log2.Load(kTestFilename, &err) || !err.empty()); } } -- cgit v0.12