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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « tools/gn/parser.cc ('k') | tools/gn/tokenizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iostream> 5 #include <iostream>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "tools/gn/input_file.h" 9 #include "tools/gn/input_file.h"
10 #include "tools/gn/parser.h" 10 #include "tools/gn/parser.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 " BLOCK\n" 582 " BLOCK\n"
583 " BINARY(=)\n" 583 " BINARY(=)\n"
584 " IDENTIFIER(sources)\n" 584 " IDENTIFIER(sources)\n"
585 " LIST\n" 585 " LIST\n"
586 " LITERAL(\"a\")\n" 586 " LITERAL(\"a\")\n"
587 " LITERAL(\"b\")\n" 587 " LITERAL(\"b\")\n"
588 " +SUFFIX_COMMENT(\"# Comment\")\n"; 588 " +SUFFIX_COMMENT(\"# Comment\")\n";
589 DoParserPrintTest(input, expected); 589 DoParserPrintTest(input, expected);
590 } 590 }
591 591
592 TEST(Parser, CommentsSuffixMultiple) {
593 const char* input =
594 "executable(\"wee\") {\n"
595 " sources = [\n"
596 " \"a\", # This is a comment,\n"
597 " # and some more,\n" // Note that this is aligned with above.
598 " # then the end.\n"
599 " ]\n"
600 "}\n";
601 const char* expected =
602 "BLOCK\n"
603 " FUNCTION(executable)\n"
604 " LIST\n"
605 " LITERAL(\"wee\")\n"
606 " BLOCK\n"
607 " BINARY(=)\n"
608 " IDENTIFIER(sources)\n"
609 " LIST\n"
610 " LITERAL(\"a\")\n"
611 " +SUFFIX_COMMENT(\"# This is a comment,\")\n"
612 " +SUFFIX_COMMENT(\"# and some more,\")\n"
613 " +SUFFIX_COMMENT(\"# then the end.\")\n";
614 DoParserPrintTest(input, expected);
615 }
616
592 TEST(Parser, HangingIf) { 617 TEST(Parser, HangingIf) {
593 DoParserErrorTest("if", 1, 1); 618 DoParserErrorTest("if", 1, 1);
594 } 619 }
595 620
596 TEST(Parser, NegatingList) { 621 TEST(Parser, NegatingList) {
597 DoParserErrorTest("executable(\"wee\") { sources =- [ \"foo.cc\" ] }", 1, 30); 622 DoParserErrorTest("executable(\"wee\") { sources =- [ \"foo.cc\" ] }", 1, 30);
598 } 623 }
OLDNEW
« 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