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

Side by Side Diff: tools/gn/parser_unittest.cc

Issue 258073004: Require commas between items in a GN list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/parser.cc ('k') | tools/gn/secondary/tools/grit/grit_rule.gni » ('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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 TEST(Parser, FunctionCall) { 118 TEST(Parser, FunctionCall) {
119 DoExpressionPrintTest("foo()", 119 DoExpressionPrintTest("foo()",
120 "FUNCTION(foo)\n" 120 "FUNCTION(foo)\n"
121 " LIST\n"); 121 " LIST\n");
122 DoExpressionPrintTest("blah(1, 2)", 122 DoExpressionPrintTest("blah(1, 2)",
123 "FUNCTION(blah)\n" 123 "FUNCTION(blah)\n"
124 " LIST\n" 124 " LIST\n"
125 " LITERAL(1)\n" 125 " LITERAL(1)\n"
126 " LITERAL(2)\n"); 126 " LITERAL(2)\n");
127 DoExpressionErrorTest("foo(1, 2,)", 1, 10); 127 DoExpressionErrorTest("foo(1, 2,)", 1, 10);
128 DoExpressionErrorTest("foo(1 2)", 1, 7);
128 } 129 }
129 130
130 TEST(Parser, ParenExpression) { 131 TEST(Parser, ParenExpression) {
131 const char* input = "(foo(1)) + (a + (b - c) + d)"; 132 const char* input = "(foo(1)) + (a + (b - c) + d)";
132 const char* expected = 133 const char* expected =
133 "BINARY(+)\n" 134 "BINARY(+)\n"
134 " FUNCTION(foo)\n" 135 " FUNCTION(foo)\n"
135 " LIST\n" 136 " LIST\n"
136 " LITERAL(1)\n" 137 " LITERAL(1)\n"
137 " BINARY(+)\n" 138 " BINARY(+)\n"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 DoParserPrintTest(input, expected); 491 DoParserPrintTest(input, expected);
491 } 492 }
492 493
493 TEST(Parser, HangingIf) { 494 TEST(Parser, HangingIf) {
494 DoParserErrorTest("if", 1, 1); 495 DoParserErrorTest("if", 1, 1);
495 } 496 }
496 497
497 TEST(Parser, NegatingList) { 498 TEST(Parser, NegatingList) {
498 DoParserErrorTest("executable(\"wee\") { sources =- [ \"foo.cc\" ] }", 1, 30); 499 DoParserErrorTest("executable(\"wee\") { sources =- [ \"foo.cc\" ] }", 1, 30);
499 } 500 }
OLDNEW
« no previous file with comments | « tools/gn/parser.cc ('k') | tools/gn/secondary/tools/grit/grit_rule.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698