diff options
author | Mohamed Bamakhrama <mohamed.bamakhrama@intel.com> | 2015-03-08 03:13:12 (GMT) |
---|---|---|
committer | Mohamed Bamakhrama <mohamed.bamakhrama@intel.com> | 2015-03-08 03:13:12 (GMT) |
commit | 2d645be0f0ffb1ad257f72ae89182e1d153ca617 (patch) | |
tree | d436987701260c0eefe2d6f129cfd6941261c60f /src/manifest_parser_test.cc | |
parent | f8f293730de2e12f6575c5d890a16504340f75fe (diff) | |
download | Ninja-2d645be0f0ffb1ad257f72ae89182e1d153ca617.zip Ninja-2d645be0f0ffb1ad257f72ae89182e1d153ca617.tar.gz Ninja-2d645be0f0ffb1ad257f72ae89182e1d153ca617.tar.bz2 |
Added a new test to illustrate scoped rules
The new test shows the added value of scoped rules by demonstrating
a multi-level build where a single rules file gets included at all
the levels. By scoping rules, this is possible.
Diffstat (limited to 'src/manifest_parser_test.cc')
-rw-r--r-- | src/manifest_parser_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 301a35c..e13d728 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -833,6 +833,19 @@ TEST_F(ParserTest, DuplicateRuleInDifferentSubninjas) { "subninja test.ninja\n", &err)); } +TEST_F(ParserTest, DuplicateRuleInDifferentSubninjasWithInclude) { + // Test that rules are scoped to subninjas even with includes. + files_["rules.ninja"] = "rule cat\n" + " command = cat\n"; + files_["test.ninja"] = "include rules.ninja\n" + "build x : cat\n"; + ManifestParser parser(&state, this); + string err; + EXPECT_TRUE(parser.ParseTest("include rules.ninja\n" + "subninja test.ninja\n" + "build y : cat\n", &err)); +} + TEST_F(ParserTest, Include) { files_["include.ninja"] = "var = inner\n"; ASSERT_NO_FATAL_FAILURE(AssertParse( |