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

Unified Diff: tools/gn/parse_tree_unittest.cc

Issue 1007963003: Fixes to {} handling in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 9 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/functions_unittest.cc ('k') | tools/gn/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/parse_tree_unittest.cc
diff --git a/tools/gn/parse_tree_unittest.cc b/tools/gn/parse_tree_unittest.cc
index 6d21227208d41c1b2961bbb0fb6adffa202dbf0d..827f3d54a5ce55d630a750fdee6163f183646598 100644
--- a/tools/gn/parse_tree_unittest.cc
+++ b/tools/gn/parse_tree_unittest.cc
@@ -56,8 +56,14 @@ TEST(ParseTree, BlockUnusedVars) {
TestWithScope setup;
// Printing both values should be OK.
+ //
+ // The crazy template definition here is a way to execute a block without
+ // defining a target. Templates require that both the target_name and the
+ // invoker be used, which is what the assertion statement inside the template
+ // does.
TestParseInput input_all_used(
- "{\n"
+ "template(\"foo\") { assert(target_name != 0 && invoker != 0) }\n"
+ "foo(\"a\") {\n"
" a = 12\n"
" b = 13\n"
" print(\"$a $b\")\n"
@@ -70,7 +76,7 @@ TEST(ParseTree, BlockUnusedVars) {
// Skipping one should throw an unused var error.
TestParseInput input_unused(
- "{\n"
+ "foo(\"a\") {\n"
" a = 12\n"
" b = 13\n"
" print(\"$a\")\n"
@@ -85,7 +91,6 @@ TEST(ParseTree, BlockUnusedVars) {
// "13" assigned to "b".
EXPECT_EQ(3, err.location().line_number());
EXPECT_EQ(7, err.location().char_offset());
-
}
TEST(ParseTree, OriginForDereference) {
« no previous file with comments | « tools/gn/functions_unittest.cc ('k') | tools/gn/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698