summaryrefslogtreecommitdiff
path: root/ninja/src/graph_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ninja/src/graph_test.cc')
-rw-r--r--ninja/src/graph_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/ninja/src/graph_test.cc b/ninja/src/graph_test.cc
index 63d5757da92..85212167e95 100644
--- a/ninja/src/graph_test.cc
+++ b/ninja/src/graph_test.cc
@@ -13,6 +13,7 @@
// limitations under the License.
#include "graph.h"
+#include "build.h"
#include "test.h"
@@ -226,3 +227,22 @@ TEST_F(GraphTest, DepfileOverrideParent) {
Edge* edge = GetNode("out")->in_edge();
EXPECT_EQ("depfile is y", edge->GetBinding("command"));
}
+
+// Verify that building a nested phony rule prints "no work to do"
+TEST_F(GraphTest, NestedPhonyPrintsDone) {
+ AssertParse(&state_,
+"build n1: phony \n"
+"build n2: phony n1\n"
+ );
+ string err;
+ Edge* edge = GetNode("n2")->in_edge();
+ EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
+ ASSERT_EQ("", err);
+
+ Plan plan_;
+ EXPECT_TRUE(plan_.AddTarget(GetNode("n2"), &err));
+ ASSERT_EQ("", err);
+
+ EXPECT_EQ(0, plan_.command_edge_count());
+ ASSERT_FALSE(plan_.more_to_do());
+}