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

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: 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 a984e8481c349fcd0fba13889498762aec822c3c..8d1d6faac20518f83b40363dcb3ee399bfbc897d 100644
--- a/tools/gn/parser_unittest.cc
+++ b/tools/gn/parser_unittest.cc
@@ -583,6 +583,32 @@ 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"
+ " # then the end.\n"
brettw 2014/09/23 21:49:09 What about this code: sources = [ "a" ] # This s
scottmg 2014/09/23 22:41:01 Yeah, it does treat it as a continuation. I notice
+ " ]\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