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

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

Issue 1263053003: Add forward_variables_from() and target() to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More spelling fixes Created 5 years, 4 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/scope.cc ('k') | tools/gn/target_generator.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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/input_file.h" 6 #include "tools/gn/input_file.h"
7 #include "tools/gn/parse_tree.h" 7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/scope.h" 8 #include "tools/gn/scope.h"
9 #include "tools/gn/template.h" 9 #include "tools/gn/template.h"
10 #include "tools/gn/test_with_scope.h" 10 #include "tools/gn/test_with_scope.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 Err err; 173 Err err;
174 Scope::MergeOptions options; 174 Scope::MergeOptions options;
175 EXPECT_TRUE(setup.scope()->NonRecursiveMergeTo( 175 EXPECT_TRUE(setup.scope()->NonRecursiveMergeTo(
176 &new_scope, options, &assignment, "error", &err)); 176 &new_scope, options, &assignment, "error", &err));
177 EXPECT_FALSE(err.has_error()); 177 EXPECT_FALSE(err.has_error());
178 EXPECT_FALSE(new_scope.CheckForUnusedVars(&err)); 178 EXPECT_FALSE(new_scope.CheckForUnusedVars(&err));
179 EXPECT_TRUE(err.has_error()); 179 EXPECT_TRUE(err.has_error());
180 } 180 }
181 181
182 // Mark used. 182 // Mark dest used.
183 { 183 {
184 Scope new_scope(setup.settings()); 184 Scope new_scope(setup.settings());
185 185
186 Err err; 186 Err err;
187 Scope::MergeOptions options; 187 Scope::MergeOptions options;
188 options.mark_used = true; 188 options.mark_dest_used = true;
189 EXPECT_TRUE(setup.scope()->NonRecursiveMergeTo( 189 EXPECT_TRUE(setup.scope()->NonRecursiveMergeTo(
190 &new_scope, options, &assignment, "error", &err)); 190 &new_scope, options, &assignment, "error", &err));
191 EXPECT_FALSE(err.has_error()); 191 EXPECT_FALSE(err.has_error());
192 EXPECT_TRUE(new_scope.CheckForUnusedVars(&err)); 192 EXPECT_TRUE(new_scope.CheckForUnusedVars(&err));
193 EXPECT_FALSE(err.has_error()); 193 EXPECT_FALSE(err.has_error());
194 } 194 }
195 } 195 }
196 196
197 TEST(Scope, MakeClosure) { 197 TEST(Scope, MakeClosure) {
198 // Create 3 nested scopes [const root from setup] <- nested1 <- nested2. 198 // Create 3 nested scopes [const root from setup] <- nested1 <- nested2.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 TEST(Scope, RemovePrivateIdentifiers) { 287 TEST(Scope, RemovePrivateIdentifiers) {
288 TestWithScope setup; 288 TestWithScope setup;
289 setup.scope()->SetValue("a", Value(nullptr, true), nullptr); 289 setup.scope()->SetValue("a", Value(nullptr, true), nullptr);
290 setup.scope()->SetValue("_b", Value(nullptr, true), nullptr); 290 setup.scope()->SetValue("_b", Value(nullptr, true), nullptr);
291 291
292 setup.scope()->RemovePrivateIdentifiers(); 292 setup.scope()->RemovePrivateIdentifiers();
293 EXPECT_TRUE(setup.scope()->GetValue("a")); 293 EXPECT_TRUE(setup.scope()->GetValue("a"));
294 EXPECT_FALSE(setup.scope()->GetValue("_b")); 294 EXPECT_FALSE(setup.scope()->GetValue("_b"));
295 } 295 }
OLDNEW
« no previous file with comments | « tools/gn/scope.cc ('k') | tools/gn/target_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698