From: Nico Weber Date: Sun, 27 Oct 2013 19:38:34 +0000 (-0700) Subject: Add a test that shows that there is a single global namespace for rules. X-Git-Tag: v1.5.0^2~50^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a36038f990db1b347ecb4cc3bfb984fc3045d04f;p=platform%2Fupstream%2Fninja.git Add a test that shows that there is a single global namespace for rules. --- diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 5ed1584..0b4c042 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -762,6 +762,21 @@ TEST_F(ParserTest, MissingSubNinja) { , err); } +TEST_F(ParserTest, DuplicateRuleInDifferentSubninjas) { + // Test that rules live in a global namespace and aren't scoped to subninjas. + files_["test.ninja"] = "rule cat\n" + " command = cat\n"; + ManifestParser parser(&state, this); + string err; + EXPECT_FALSE(parser.ParseTest("rule cat\n" + " command = cat\n" + "subninja test.ninja\n", &err)); + EXPECT_EQ("test.ninja:1: duplicate rule 'cat'\n" + "rule cat\n" + " ^ near here" + , err); +} + TEST_F(ParserTest, Include) { files_["include.ninja"] = "var = inner\n"; ASSERT_NO_FATAL_FAILURE(AssertParse(