summaryrefslogtreecommitdiffstats
path: root/src/build_log_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/build_log_test.cc')
-rw-r--r--src/build_log_test.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/build_log_test.cc b/src/build_log_test.cc
index a6c2a86..2dd6500 100644
--- a/src/build_log_test.cc
+++ b/src/build_log_test.cc
@@ -26,6 +26,8 @@
#include <unistd.h>
#endif
+namespace {
+
const char kTestFilename[] = "BuildLogTest-tempfile";
struct BuildLogTest : public StateTestWithBuiltinRules {
@@ -145,7 +147,8 @@ TEST_F(BuildLogTest, Truncate) {
ASSERT_EQ(0, truncate(kTestFilename, size));
#else
int fh;
- fh = _sopen(kTestFilename, _O_RDWR | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
+ fh = _sopen(kTestFilename, _O_RDWR | _O_CREAT, _SH_DENYNO,
+ _S_IREAD | _S_IWRITE);
ASSERT_EQ(0, _chsize(fh, size));
_close(fh);
#endif
@@ -245,3 +248,25 @@ TEST_F(BuildLogTest, VeryLongInputLine) {
ASSERT_EQ(789, e->restat_mtime);
ASSERT_NO_FATAL_FAILURE(AssertHash("command2", e->command_hash));
}
+
+TEST_F(BuildLogTest, MultiTargetEdge) {
+ AssertParse(&state_,
+"build out out.d: cat\n");
+
+ BuildLog log;
+ log.RecordCommand(state_.edges_[0], 21, 22);
+
+ ASSERT_EQ(2u, log.entries().size());
+ BuildLog::LogEntry* e1 = log.LookupByOutput("out");
+ ASSERT_TRUE(e1);
+ BuildLog::LogEntry* e2 = log.LookupByOutput("out.d");
+ ASSERT_TRUE(e2);
+ ASSERT_EQ("out", e1->output);
+ ASSERT_EQ("out.d", e2->output);
+ ASSERT_EQ(21, e1->start_time);
+ ASSERT_EQ(21, e2->start_time);
+ ASSERT_EQ(22, e2->end_time);
+ ASSERT_EQ(22, e2->end_time);
+}
+
+} // anonymous namespace