diff options
author | Evan Martin <martine@danga.com> | 2011-05-01 01:49:50 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-05-01 02:03:12 (GMT) |
commit | f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09 (patch) | |
tree | 870998bffa3a0e427a14daa15d75ac22c243db59 /src/parsers_test.cc | |
parent | bce2d134b166c570e659ff43923103f241a614de (diff) | |
download | Ninja-f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09.zip Ninja-f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09.tar.gz Ninja-f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09.tar.bz2 |
drop reserved words 'build'/'rule'/'subninja'/etc.
Instead, parse them as normal words, which makes them work as paths.
We instead rely on the *position* (i.e., we start a statement with a
keyword and not a path) to distinguish the keyword 'build' from the file
'build'.
Diffstat (limited to 'src/parsers_test.cc')
-rw-r--r-- | src/parsers_test.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parsers_test.cc b/src/parsers_test.cc index c20a812..9bd16a9 100644 --- a/src/parsers_test.cc +++ b/src/parsers_test.cc @@ -174,6 +174,13 @@ TEST_F(ParserTest, CanonicalizePaths) { EXPECT_TRUE(state.LookupNode("bar/foo.cc")); } +TEST_F(ParserTest, ReservedWords) { + ASSERT_NO_FATAL_FAILURE(AssertParse( +"rule build\n" +" command = rule run $out\n" +"build subninja: build include foo.cc\n")); +} + TEST_F(ParserTest, Errors) { { ManifestParser parser(NULL, NULL); |