| Index: tools/gn/parser_unittest.cc
|
| diff --git a/tools/gn/parser_unittest.cc b/tools/gn/parser_unittest.cc
|
| index 226143ac8f6a46d9d128dd7ab4ce41a7a5fc07a6..1a3df4aa695b9872b96b6889bdc7e90b3dfb8dcf 100644
|
| --- a/tools/gn/parser_unittest.cc
|
| +++ b/tools/gn/parser_unittest.cc
|
| @@ -633,6 +633,41 @@ TEST(Parser, CommentsConnectedInList) {
|
| DoParserPrintTest(input, expected);
|
| }
|
|
|
| +TEST(Parser, CommentsAtEndOfBlock) {
|
| + const char* input =
|
| + "if (is_win) {\n"
|
| + " sources = [\"a.cc\"]\n"
|
| + " # Some comment at end.\n"
|
| + "}\n";
|
| + const char* expected =
|
| + "BLOCK\n"
|
| + " CONDITION\n"
|
| + " IDENTIFIER(is_win)\n"
|
| + " BLOCK\n"
|
| + " BINARY(=)\n"
|
| + " IDENTIFIER(sources)\n"
|
| + " LIST\n"
|
| + " LITERAL(\"a.cc\")\n"
|
| + " END(})\n"
|
| + " +BEFORE_COMMENT(\"# Some comment at end.\")\n";
|
| + DoParserPrintTest(input, expected);
|
| +}
|
| +
|
| +// TODO(scottmg): I could be convinced this is incorrect. It's not clear to me
|
| +// which thing this comment is intended to be attached to.
|
| +TEST(Parser, CommentsEndOfBlockSingleLine) {
|
| + const char* input =
|
| + "defines = [ # EOL defines.\n"
|
| + "]\n";
|
| + const char* expected =
|
| + "BLOCK\n"
|
| + " BINARY(=)\n"
|
| + " IDENTIFIER(defines)\n"
|
| + " +SUFFIX_COMMENT(\"# EOL defines.\")\n"
|
| + " LIST\n";
|
| + DoParserPrintTest(input, expected);
|
| +}
|
| +
|
| TEST(Parser, HangingIf) {
|
| DoParserErrorTest("if", 1, 1);
|
| }
|
|
|