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

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

Issue 1275583002: Pull ICU, rename component build GN variables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « third_party/libpng/BUILD.gn ('k') | no next file » | 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/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
11 // Checks that we find unused identifiers in targets. 11 // Checks that we find unused identifiers in targets.
12 TEST(FunctionsTarget, CheckUnused) { 12 TEST(FunctionsTarget, CheckUnused) {
13 Scheduler scheduler; 13 Scheduler scheduler;
14 TestWithScope setup; 14 TestWithScope setup;
15 15
16 // The target generator needs a place to put the targets or it will fail. 16 // The target generator needs a place to put the targets or it will fail.
17 Scope::ItemVector item_collector; 17 Scope::ItemVector item_collector;
18 setup.scope()->set_item_collector(&item_collector); 18 setup.scope()->set_item_collector(&item_collector);
19 19
20 // Test a good one first. 20 // Test a good one first.
21 TestParseInput good_input( 21 TestParseInput good_input(
22 "source_set(\"foo\") {\n" 22 "source_set(\"foo\") {\n"
23 "}\n"); 23 "}\n");
24 ASSERT_FALSE(good_input.has_error()); 24 ASSERT_FALSE(good_input.has_error());
25 Err err; 25 Err err;
26 good_input.parsed()->Execute(setup.scope(), &err); 26 good_input.parsed()->Execute(setup.scope(), &err);
27 ASSERT_FALSE(err.has_error()) << err.message(); 27 ASSERT_FALSE(err.has_error()) << err.message();
28 28
29 // Test a source set (this covers everything but component) with an unused 29 // Test a source set with an unused variable.
30 // variable.
31 TestParseInput source_set_input( 30 TestParseInput source_set_input(
32 "source_set(\"foo\") {\n" 31 "source_set(\"foo\") {\n"
33 " unused = 5\n" 32 " unused = 5\n"
34 "}\n"); 33 "}\n");
35 ASSERT_FALSE(source_set_input.has_error()); 34 ASSERT_FALSE(source_set_input.has_error());
36 err = Err(); 35 err = Err();
37 source_set_input.parsed()->Execute(setup.scope(), &err); 36 source_set_input.parsed()->Execute(setup.scope(), &err);
38 ASSERT_TRUE(err.has_error()); 37 ASSERT_TRUE(err.has_error());
39
40 // Test a component, which is a different code path.
41 TestParseInput component_input(
42 "component_mode = \"static_library\"\n"
43 "component(\"bar\") {\n"
44 " unused = 5\n"
45 "}\n");
46 ASSERT_FALSE(component_input.has_error());
47 err = Err();
48 component_input.parsed()->Execute(setup.scope(), &err);
49 ASSERT_TRUE(err.has_error()) << err.message();
50 } 38 }
OLDNEW
« no previous file with comments | « third_party/libpng/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698