summaryrefslogtreecommitdiffstats
path: root/src/graph_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-13 17:47:26 (GMT)
committerEvan Martin <martine@danga.com>2011-05-13 23:28:41 (GMT)
commit54ae1a37ea6396628b75bdc0021f1ef4848deb84 (patch)
tree80396559a2aaa190854654acd2af00b646e1dd9f /src/graph_test.cc
parent400ca686fed88e4ab49541829657d0edec02f9aa (diff)
downloadNinja-54ae1a37ea6396628b75bdc0021f1ef4848deb84.zip
Ninja-54ae1a37ea6396628b75bdc0021f1ef4848deb84.tar.gz
Ninja-54ae1a37ea6396628b75bdc0021f1ef4848deb84.tar.bz2
SEMANTIC CHANGE: implicit inputs are now required to exist
Edges found through depfiles are special: they get an extra empty "phony" rule. (This is identical to the way you hack this with Makefiles.)
Diffstat (limited to 'src/graph_test.cc')
-rw-r--r--src/graph_test.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/graph_test.cc b/src/graph_test.cc
index 9a5035c..e221089 100644
--- a/src/graph_test.cc
+++ b/src/graph_test.cc
@@ -31,8 +31,26 @@ TEST_F(GraphTest, MissingImplicit) {
EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err));
ASSERT_EQ("", err);
- // A missing implicit dep does not make the output dirty.
- EXPECT_FALSE(GetNode("out")->dirty_);
+ // A missing implicit dep *should* make the output dirty.
+ // (In fact, a build will fail.)
+ // This is a change from prior semantics of ninja.
+ EXPECT_TRUE(GetNode("out")->dirty_);
+}
+
+TEST_F(GraphTest, ModifiedImplicit) {
+ ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
+"build out: cat in | implicit\n"));
+ fs_.Create("in", 1, "");
+ fs_.Create("out", 1, "");
+ fs_.Create("implicit", 2, "");
+
+ Edge* edge = GetNode("out")->in_edge_;
+ string err;
+ EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err));
+ ASSERT_EQ("", err);
+
+ // A modified implicit dep should make the output dirty.
+ EXPECT_TRUE(GetNode("out")->dirty_);
}
TEST_F(GraphTest, FunkyMakefilePath) {