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

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

Issue 2481423002: Convert gn docstrings to C++11 raw strings. (Closed)
Patch Set: More Created 4 years, 1 month 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
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/scheduler.h" 6 #include "tools/gn/scheduler.h"
7 #include "tools/gn/scope.h" 7 #include "tools/gn/scope.h"
8 #include "tools/gn/test_with_scope.h" 8 #include "tools/gn/test_with_scope.h"
9 9
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TEST(FunctionsTarget, TemplateDefaults) { 43 TEST(FunctionsTarget, TemplateDefaults) {
44 Scheduler scheduler; 44 Scheduler scheduler;
45 TestWithScope setup; 45 TestWithScope setup;
46 46
47 // The target generator needs a place to put the targets or it will fail. 47 // The target generator needs a place to put the targets or it will fail.
48 Scope::ItemVector item_collector; 48 Scope::ItemVector item_collector;
49 setup.scope()->set_item_collector(&item_collector); 49 setup.scope()->set_item_collector(&item_collector);
50 50
51 // Test a good one first. 51 // Test a good one first.
52 TestParseInput good_input( 52 TestParseInput good_input(
53 // Make a template with defaults set. 53 R"(# Make a template with defaults set.
54 "template(\"my_templ\") {\n" 54 template("my_templ") {
55 " source_set(target_name) {\n" 55 source_set(target_name) {
56 " forward_variables_from(invoker, \"*\")\n" 56 forward_variables_from(invoker, "*")
57 " }\n" 57 }
58 "}\n" 58 }
59 "set_defaults(\"my_templ\") {\n" 59 set_defaults("my_templ") {
60 " default_value = 1\n" 60 default_value = 1
61 "}\n" 61 }
62 62
63 // Invoke the template with target(). This will fail to execute if the 63 # Invoke the template with target(). This will fail to execute if the
64 // defaults were not set properly, because "default_value" won't exist. 64 # defaults were not set properly, because "default_value" won't exist.
65 "target(\"my_templ\", \"foo\") {\n" 65 target("my_templ", "foo") {
66 " print(default_value)\n" 66 print(default_value)
67 "}\n"); 67 })");
scottmg 2016/11/08 01:01:46 here
68 ASSERT_FALSE(good_input.has_error()); 68 ASSERT_FALSE(good_input.has_error());
69 Err err; 69 Err err;
70 good_input.parsed()->Execute(setup.scope(), &err); 70 good_input.parsed()->Execute(setup.scope(), &err);
71 ASSERT_FALSE(err.has_error()) << err.message(); 71 ASSERT_FALSE(err.has_error()) << err.message();
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698