summaryrefslogtreecommitdiffstats
path: root/src/graph_test.cc
diff options
context:
space:
mode:
authorRichard Geary <richardg.work@gmail.com>2013-08-11 00:14:49 (GMT)
committerRichard Geary <richardg.work@gmail.com>2013-08-11 00:15:22 (GMT)
commitb78b27cba23e3bd2fce1cea4bf33a85eb645113d (patch)
treee4cb106f0ba2cf03140d8b400de190a0969c943b /src/graph_test.cc
parent3f03746c458a92cfb6d2c8a89169ead8db5aaf1f (diff)
downloadNinja-b78b27cba23e3bd2fce1cea4bf33a85eb645113d.zip
Ninja-b78b27cba23e3bd2fce1cea4bf33a85eb645113d.tar.gz
Ninja-b78b27cba23e3bd2fce1cea4bf33a85eb645113d.tar.bz2
Fix for missing "no work to do." message if all build edges are phony rules.
Added NestedPhonyPrintsDone unit test
Diffstat (limited to 'src/graph_test.cc')
-rw-r--r--src/graph_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/graph_test.cc b/src/graph_test.cc
index 63d5757..8521216 100644
--- a/src/graph_test.cc
+++ b/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());
+}