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

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

Issue 654263004: Simplify ScopedVector<scoped_ptr<T>> to ScopedVector<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 } // namespace 59 } // namespace
60 60
61 TEST_F(GetTargetOutputsTest, Copy) { 61 TEST_F(GetTargetOutputsTest, Copy) {
62 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar")); 62 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar"));
63 action->set_output_type(Target::COPY_FILES); 63 action->set_output_type(Target::COPY_FILES);
64 action->sources().push_back(SourceFile("//file.txt")); 64 action->sources().push_back(SourceFile("//file.txt"));
65 action->action_values().outputs() = 65 action->action_values().outputs() =
66 SubstitutionList::MakeForTest("//out/Debug/{{source_file_part}}.one"); 66 SubstitutionList::MakeForTest("//out/Debug/{{source_file_part}}.one");
67 67
68 items_.push_back(new scoped_ptr<Item>(action)); 68 items_.push_back(action);
69 69
70 Err err; 70 Err err;
71 Value result = GetTargetOutputs("//foo:bar", &err); 71 Value result = GetTargetOutputs("//foo:bar", &err);
72 ASSERT_FALSE(err.has_error()); 72 ASSERT_FALSE(err.has_error());
73 AssertSingleStringEquals(result, "//out/Debug/file.txt.one"); 73 AssertSingleStringEquals(result, "//out/Debug/file.txt.one");
74 } 74 }
75 75
76 TEST_F(GetTargetOutputsTest, Action) { 76 TEST_F(GetTargetOutputsTest, Action) {
77 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar")); 77 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar"));
78 action->set_output_type(Target::ACTION); 78 action->set_output_type(Target::ACTION);
79 action->action_values().outputs() = SubstitutionList::MakeForTest( 79 action->action_values().outputs() = SubstitutionList::MakeForTest(
80 "//output1.txt", 80 "//output1.txt",
81 "//output2.txt"); 81 "//output2.txt");
82 82
83 items_.push_back(new scoped_ptr<Item>(action)); 83 items_.push_back(action);
84 84
85 Err err; 85 Err err;
86 Value result = GetTargetOutputs("//foo:bar", &err); 86 Value result = GetTargetOutputs("//foo:bar", &err);
87 ASSERT_FALSE(err.has_error()); 87 ASSERT_FALSE(err.has_error());
88 AssertTwoStringsEqual(result, "//output1.txt", "//output2.txt"); 88 AssertTwoStringsEqual(result, "//output1.txt", "//output2.txt");
89 } 89 }
90 90
91 TEST_F(GetTargetOutputsTest, ActionForeach) { 91 TEST_F(GetTargetOutputsTest, ActionForeach) {
92 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar")); 92 Target* action = new Target(setup_.settings(), GetLabel("//foo/", "bar"));
93 action->set_output_type(Target::ACTION_FOREACH); 93 action->set_output_type(Target::ACTION_FOREACH);
94 action->sources().push_back(SourceFile("//file.txt")); 94 action->sources().push_back(SourceFile("//file.txt"));
95 action->action_values().outputs() = SubstitutionList::MakeForTest( 95 action->action_values().outputs() = SubstitutionList::MakeForTest(
96 "//out/Debug/{{source_file_part}}.one", 96 "//out/Debug/{{source_file_part}}.one",
97 "//out/Debug/{{source_file_part}}.two"); 97 "//out/Debug/{{source_file_part}}.two");
98 98
99 items_.push_back(new scoped_ptr<Item>(action)); 99 items_.push_back(action);
100 100
101 Err err; 101 Err err;
102 Value result = GetTargetOutputs("//foo:bar", &err); 102 Value result = GetTargetOutputs("//foo:bar", &err);
103 ASSERT_FALSE(err.has_error()); 103 ASSERT_FALSE(err.has_error());
104 AssertTwoStringsEqual(result, "//out/Debug/file.txt.one", 104 AssertTwoStringsEqual(result, "//out/Debug/file.txt.one",
105 "//out/Debug/file.txt.two"); 105 "//out/Debug/file.txt.two");
106 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698