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

Unified Diff: tools/gn/parser_unittest.cc

Issue 595753002: gn: handle continued suffix comments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-append-comment
Patch Set: only continue if at same column 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/tokenizer.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 6f08c723eb1e88a6d97b83910dcd58fb87e39c3d..5a428be0d5b538b10a5823d8ab47e93243498e03 100644
--- a/tools/gn/parser_unittest.cc
+++ b/tools/gn/parser_unittest.cc
@@ -589,6 +589,31 @@ TEST(Parser, CommentsSuffixDifferentLine) {
DoParserPrintTest(input, expected);
}
+TEST(Parser, CommentsSuffixMultiple) {
+ const char* input =
+ "executable(\"wee\") {\n"
+ " sources = [\n"
+ " \"a\", # This is a comment,\n"
+ " # and some more,\n" // Note that this is aligned with above.
+ " # then the end.\n"
+ " ]\n"
+ "}\n";
+ const char* expected =
+ "BLOCK\n"
+ " FUNCTION(executable)\n"
+ " LIST\n"
+ " LITERAL(\"wee\")\n"
+ " BLOCK\n"
+ " BINARY(=)\n"
+ " IDENTIFIER(sources)\n"
+ " LIST\n"
+ " LITERAL(\"a\")\n"
+ " +SUFFIX_COMMENT(\"# This is a comment,\")\n"
+ " +SUFFIX_COMMENT(\"# and some more,\")\n"
+ " +SUFFIX_COMMENT(\"# then the end.\")\n";
+ DoParserPrintTest(input, expected);
+}
+
TEST(Parser, HangingIf) {
DoParserErrorTest("if", 1, 1);
}
« no previous file with comments | « tools/gn/parser.cc ('k') | tools/gn/tokenizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698