diff options
author | Evan Martin <martine@danga.com> | 2010-10-24 05:14:23 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2010-10-24 05:14:23 (GMT) |
commit | 078774f7316b6afbd67b3b7b8986fae419fbc471 (patch) | |
tree | 73b1f5fa1b576e46113351ae1076b30280878e11 /ninja_test.cc | |
parent | c42e512fb56b5e12116a759f5c3e30bf3ad28c0b (diff) | |
download | Ninja-078774f7316b6afbd67b3b7b8986fae419fbc471.zip Ninja-078774f7316b6afbd67b3b7b8986fae419fbc471.tar.gz Ninja-078774f7316b6afbd67b3b7b8986fae419fbc471.tar.bz2 |
rewrite parser to tokenize
Diffstat (limited to 'ninja_test.cc')
-rw-r--r-- | ninja_test.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ninja_test.cc b/ninja_test.cc index 76175d5..8ed448d 100644 --- a/ninja_test.cc +++ b/ninja_test.cc @@ -73,7 +73,7 @@ TEST(Parser, Errors) { ManifestParser parser(NULL); string err; EXPECT_FALSE(parser.Parse("foobar", &err)); - EXPECT_EQ("line 1, col 7: expected '=', got ''", err); + EXPECT_EQ("line 1, col 7: expected '=', got eof", err); } { @@ -103,6 +103,21 @@ TEST(Parser, Errors) { EXPECT_FALSE(parser.Parse("build x: y z\n", &err)); EXPECT_EQ("line 1, col 10: unknown build rule 'y'", err); } + + { + ManifestParser parser(&state); + string err; + EXPECT_FALSE(parser.Parse("build x:: y z\n", &err)); + EXPECT_EQ("line 1, col 9: expected build command name", err); + } + + { + ManifestParser parser(&state); + string err; + EXPECT_FALSE(parser.Parse("rule cat\ncommand cat ok\nbuild x: cat \\\n :\n", + &err)); + EXPECT_EQ("line 4, col 1: expected newline, got ':'", err); + } } TEST(Parser, BuildDir) { |