Add a space to unexpected token errors.
authorEvan Jones <ej@evanjones.ca>
Wed, 4 Jan 2012 16:40:30 +0000 (11:40 -0500)
committerEvan Martin <martine@danga.com>
Wed, 4 Jan 2012 17:06:19 +0000 (09:06 -0800)
src/parsers.cc
src/parsers_test.cc

index 506b209..afb097a 100644 (file)
@@ -78,7 +78,7 @@ bool ManifestParser::Parse(const string& filename, const string& input,
     case Lexer::NEWLINE:
       break;
     default:
-      return lexer_.Error(string("unexpected") + Lexer::TokenName(token),
+      return lexer_.Error(string("unexpected ") + Lexer::TokenName(token),
                           err);
     }
   }
index 9d46beb..e7047da 100644 (file)
@@ -448,6 +448,13 @@ TEST_F(ParserTest, Errors) {
     // as we see them, not after we've read them all!
     EXPECT_EQ("input:4: empty path\n", err);
   }
+
+  {
+    ManifestParser parser(NULL, NULL);
+    string err;
+    EXPECT_FALSE(parser.ParseTest(" # bad indented comment\n", &err));
+    EXPECT_EQ("input:1: unexpected indent\n", err);
+  }
 }
 
 TEST_F(ParserTest, MultipleOutputs)