summaryrefslogtreecommitdiffstats
path: root/src/build_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-04-26 03:30:35 (GMT)
committerEvan Martin <martine@danga.com>2012-04-26 03:39:14 (GMT)
commit2ddef5b052c42876333928bc9591ad6ff8953fab (patch)
tree400c049ed782f51add2896b9edc700215c3dee60 /src/build_test.cc
parent496f7729009c46691a3210fcb67c418aa102da96 (diff)
downloadNinja-2ddef5b052c42876333928bc9591ad6ff8953fab.zip
Ninja-2ddef5b052c42876333928bc9591ad6ff8953fab.tar.gz
Ninja-2ddef5b052c42876333928bc9591ad6ff8953fab.tar.bz2
reduce custom ninja status patch in minor ways
Elsewhere in the code I avoid sstream and manual buffer management, so switch this code to behave similarly. Sorry for being OCD.
Diffstat (limited to 'src/build_test.cc')
-rw-r--r--src/build_test.cc33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/build_test.cc b/src/build_test.cc
index f3f5472..c45f2b3 100644
--- a/src/build_test.cc
+++ b/src/build_test.cc
@@ -1024,36 +1024,7 @@ TEST_F(BuildTest, PhonyWithNoInputs) {
ASSERT_EQ(1u, commands_ran_.size());
}
-TEST_F(BuildTest, StatusFormatBufferTooSmall) {
- const int kBUFF_SIZE = 5;
- char buff[kBUFF_SIZE] = { '\0' };
- string err;
-
- EXPECT_EQ(-1, status_.FormatProgressStatus("0123456789",
- buff, kBUFF_SIZE,
- &err));
- EXPECT_EQ("custom NINJA_STATUS exceed buffer size 5", err);
-}
-
-TEST_F(BuildTest, StatusFormatWrongPlaceholder) {
- const int kBUFF_SIZE = 1024;
- char buff[kBUFF_SIZE] = { '\0' };
- string err;
-
- EXPECT_EQ(-1, status_.FormatProgressStatus("[%r/%X]",
- buff, kBUFF_SIZE,
- &err));
- EXPECT_EQ("unknown placeholders '%X' in NINJA_STATUS", err);
-}
-
TEST_F(BuildTest, StatusFormatReplacePlaceholder) {
- const int kBUFF_SIZE = 1024;
- char buff[kBUFF_SIZE] = { '\0' };
- string err;
-
- EXPECT_EQ(18, status_.FormatProgressStatus("[%%/s%s/t%t/r%r/u%u/f%f]",
- buff, kBUFF_SIZE,
- &err));
- EXPECT_EQ("", err);
- EXPECT_STREQ("[%/s0/t0/r0/u0/f0]", buff);
+ EXPECT_EQ("[%/s0/t0/r0/u0/f0]",
+ status_.FormatProgressStatus("[%%/s%s/t%t/r%r/u%u/f%f]"));
}