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

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

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unsigned check Created 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/function_get_target_outputs.cc ('k') | tools/gn/function_rebase_path.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/functions.h" 6 #include "tools/gn/functions.h"
7 #include "tools/gn/target.h" 7 #include "tools/gn/target.h"
8 #include "tools/gn/test_with_scope.h" 8 #include "tools/gn/test_with_scope.h"
9 9
10 namespace { 10 namespace {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 protected: 53 protected:
54 TestWithScope setup_; 54 TestWithScope setup_;
55 55
56 Scope::ItemVector items_; 56 Scope::ItemVector items_;
57 }; 57 };
58 58
59 } // namespace 59 } // namespace
60 60
61 TEST_F(GetTargetOutputsTest, Executable) {
62 Target* exe = new Target(setup_.settings(), GetLabel("//foo/", "bar"));
63 exe->set_output_type(Target::EXECUTABLE);
64 items_.push_back(new scoped_ptr<Item>(exe));
65
66 Err err;
67 Value result = GetTargetOutputs("//foo:bar", &err);
68 ASSERT_FALSE(err.has_error());
69 // The TestWithScope declares that the build is Linux, so we'll have no
70 // extension for the binaries.
71 AssertSingleStringEquals(result, "//out/Debug/bar");
72 }
73
74 TEST_F(GetTargetOutputsTest, SourceSet) {
75 Target* source_set = new Target(setup_.settings(), GetLabel("//foo/", "bar"));
76 source_set->set_output_type(Target::SOURCE_SET);
77 items_.push_back(new scoped_ptr<Item>(source_set));
78
79 Err err;
80 Value result = GetTargetOutputs("//foo:bar", &err);
81 ASSERT_FALSE(err.has_error());
82 AssertSingleStringEquals(result, "//out/Debug/obj/foo/bar.stamp");
83 }
84
85 TEST_F(GetTargetOutputsTest, Copy) { 61 TEST_F(GetTargetOutputsTest, Copy) {
86 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar")); 62 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar"));
87 action->set_output_type(Target::COPY_FILES); 63 action->set_output_type(Target::COPY_FILES);
88 action->sources().push_back(SourceFile("//file.txt")); 64 action->sources().push_back(SourceFile("//file.txt"));
89 action->action_values().outputs() = 65 action->action_values().outputs() =
90 SubstitutionList::MakeForTest("//out/Debug/{{source_file_part}}.one"); 66 SubstitutionList::MakeForTest("//out/Debug/{{source_file_part}}.one");
91 67
92 items_.push_back(new scoped_ptr<Item>(action)); 68 items_.push_back(new scoped_ptr<Item>(action));
93 69
94 Err err; 70 Err err;
(...skipping 26 matching lines...) Expand all
121 "//out/Debug/{{source_file_part}}.two"); 97 "//out/Debug/{{source_file_part}}.two");
122 98
123 items_.push_back(new scoped_ptr<Item>(action)); 99 items_.push_back(new scoped_ptr<Item>(action));
124 100
125 Err err; 101 Err err;
126 Value result = GetTargetOutputs("//foo:bar", &err); 102 Value result = GetTargetOutputs("//foo:bar", &err);
127 ASSERT_FALSE(err.has_error()); 103 ASSERT_FALSE(err.has_error());
128 AssertTwoStringsEqual(result, "//out/Debug/file.txt.one", 104 AssertTwoStringsEqual(result, "//out/Debug/file.txt.one",
129 "//out/Debug/file.txt.two"); 105 "//out/Debug/file.txt.two");
130 } 106 }
OLDNEW
« no previous file with comments | « tools/gn/function_get_target_outputs.cc ('k') | tools/gn/function_rebase_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698