Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1986)

Unified Diff: tools/gn/parser_unittest.cc

Issue 588813002: gn: beginnings of format command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle line comments at eof Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/parser.cc ('k') | tools/gn/scope_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/parser_unittest.cc
diff --git a/tools/gn/parser_unittest.cc b/tools/gn/parser_unittest.cc
index 1205038a8bccf7cf92b1c04c598ac5425cb48014..09930a461d6c64f5917d9c2ddca5c9690fec164a 100644
--- a/tools/gn/parser_unittest.cc
+++ b/tools/gn/parser_unittest.cc
@@ -491,6 +491,51 @@ TEST(Parser, LongExpression) {
DoParserPrintTest(input, expected);
}
+TEST(Parser, CommentsStandalone) {
+ const char* input = "# Toplevel comment.\n\nexecutable(\"wee\") {}\n";
+ const char* expected =
+ "BLOCK\n"
+ " +BEFORE_COMMENT(\"# Toplevel comment.\")\n"
+ " FUNCTION(executable)\n"
+ " LIST\n"
+ " LITERAL(\"wee\")\n"
+ " BLOCK\n";
+ DoParserPrintTest(input, expected);
+}
+
+TEST(Parser, CommentsStandaloneEof) {
+ const char* input = "executable(\"wee\") {}\n# EOF comment.\n";
+ const char* expected =
+ "BLOCK\n"
+ " +AFTER_COMMENT(\"# EOF comment.\")\n"
+ " FUNCTION(executable)\n"
+ " LIST\n"
+ " LITERAL(\"wee\")\n"
+ " BLOCK\n";
+ DoParserPrintTest(input, expected);
+}
+
+/* TODO(scottmg): Not implemented yet.
+TEST(Parser, CommentsSuffix) {
+ const char* input = "executable(\"wee\") { # This is some stuff.\n"
+ "sources = [ \"a.cc\"\n"
+ "] }";
+ const char* expected =
+ "BLOCK\n"
+ " FUNCTION(executable)\n"
+ " LIST\n"
+ " LITERAL(\"wee\")\n"
+ " +SUFFIX_COMMENT(\"# This is some stuff.\")\n"
+ " BLOCK\n"
+ " BINARY(=)\n"
+ " IDENTIFIER(sources)\n"
+ " LIST\n"
+ " LITERAL(\"a.cc\")\n"
+ " +SUFFIX_COMMENT(\"# And another comment here.\")\n";
+ DoParserPrintTest(input, expected);
+}
+*/
+
TEST(Parser, HangingIf) {
DoParserErrorTest("if", 1, 1);
}
« no previous file with comments | « tools/gn/parser.cc ('k') | tools/gn/scope_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698