summaryrefslogtreecommitdiffstats
path: root/src/manifest_parser_test.cc
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-03-24 21:16:07 (GMT)
committerNico Weber <thakis@chromium.org>2015-03-24 22:26:48 (GMT)
commit92b74c340ab6397cb728391995f86dfdb39bb186 (patch)
tree4c27f44479075415dbc6fcf656cae8ce4727f20a /src/manifest_parser_test.cc
parent6bac2fba25df89df748c44de1d9d3b9f546d3aac (diff)
downloadNinja-92b74c340ab6397cb728391995f86dfdb39bb186.zip
Ninja-92b74c340ab6397cb728391995f86dfdb39bb186.tar.gz
Ninja-92b74c340ab6397cb728391995f86dfdb39bb186.tar.bz2
Add an opt-in flag to make duplicate edges an error (`-w dupbuild=err`).
This is step 1 on #931. Duplicated edges will become an error by default in the future.
Diffstat (limited to 'src/manifest_parser_test.cc')
-rw-r--r--src/manifest_parser_test.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc
index 7e72b34..8f7b575 100644
--- a/src/manifest_parser_test.cc
+++ b/src/manifest_parser_test.cc
@@ -364,6 +364,19 @@ TEST_F(ParserTest, NoDeadPointerFromDuplicateEdge) {
// That's all the checking that this test needs.
}
+TEST_F(ParserTest, DuplicateEdgeWithMultipleOutputsError) {
+ const char kInput[] =
+"rule cat\n"
+" command = cat $in > $out\n"
+"build out1 out2: cat in1\n"
+"build out1: cat in2\n"
+"build final: cat out1\n";
+ ManifestParser parser(&state, this, /*dupe_edges_should_err=*/true);
+ string err;
+ EXPECT_FALSE(parser.ParseTest(kInput, &err));
+ EXPECT_EQ("input:5: multiple rules generate out1 [-w dupbuild=err]\n", err);
+}
+
TEST_F(ParserTest, ReservedWords) {
ASSERT_NO_FATAL_FAILURE(AssertParse(
"rule build\n"