summaryrefslogtreecommitdiffstats
path: root/src/graph_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-03-07 19:25:10 (GMT)
committerEvan Martin <martine@danga.com>2011-03-07 19:25:54 (GMT)
commit15d4695878749c3525c96e856ef08dfb19a2c3e5 (patch)
treed5829403a867eb44e1e7ec957ab77fcf2ad707c8 /src/graph_test.cc
parenta5980c6bb2d6ccb6ffed2d92304c55ba94622963 (diff)
downloadNinja-15d4695878749c3525c96e856ef08dfb19a2c3e5.zip
Ninja-15d4695878749c3525c96e856ef08dfb19a2c3e5.tar.gz
Ninja-15d4695878749c3525c96e856ef08dfb19a2c3e5.tar.bz2
files that have both implicit and explicit edges should be implicit
This is just deleting some code that was written in anticipation of staying memory-resident; when loading a depfile, we don't need to attempt to update existing entries in the dependency list, we just need to blindly add them.
Diffstat (limited to 'src/graph_test.cc')
-rw-r--r--src/graph_test.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/graph_test.cc b/src/graph_test.cc
index 758315e..b67cf99 100644
--- a/src/graph_test.cc
+++ b/src/graph_test.cc
@@ -88,3 +88,27 @@ TEST_F(GraphTest, FunkyMakefilePath) {
// non-canonical path; we should still find it.
EXPECT_TRUE(GetNode("out.o")->dirty_);
}
+
+TEST_F(GraphTest, ExplicitImplicit) {
+ ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
+"rule catdep\n"
+" depfile = $out.d\n"
+" command = cat $in > $out\n"
+"build implicit.h: cat data\n"
+"build out.o: catdep foo.cc || implicit.h\n"));
+ fs_.Create("data", 2, "");
+ fs_.Create("implicit.h", 1, "");
+ fs_.Create("foo.cc", 1, "");
+ fs_.Create("out.o.d", 1, "out.o: implicit.h\n");
+ fs_.Create("out.o", 1, "");
+
+ Edge* edge = GetNode("out.o")->in_edge_;
+ string err;
+ EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err));
+ ASSERT_EQ("", err);
+
+ // We have both an implicit and an explicit dep on implicit.h.
+ // The implicit dep should "win" (in the sense that it should cause
+ // the output to be dirty).
+ EXPECT_TRUE(GetNode("out.o")->dirty_);
+}