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

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

Issue 2071573003: GN: Use implicit dependency for binary input deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes Created 4 years, 6 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/ninja_target_writer.cc ('k') | tools/gn/variables.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 <sstream> 5 #include <sstream>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/ninja_target_writer.h" 8 #include "tools/gn/ninja_target_writer.h"
9 #include "tools/gn/target.h" 9 #include "tools/gn/target.h"
10 #include "tools/gn/test_with_scope.h" 10 #include "tools/gn/test_with_scope.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 EXPECT_EQ("", stream.str()); 78 EXPECT_EQ("", stream.str());
79 } 79 }
80 80
81 // Input deps for the target (should depend on the base). 81 // Input deps for the target (should depend on the base).
82 { 82 {
83 std::ostringstream stream; 83 std::ostringstream stream;
84 TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream); 84 TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream);
85 OutputFile dep = 85 OutputFile dep =
86 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>()); 86 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>());
87 87
88 // Since there is more than one dependency, a stamp file will be returned 88 // Since there is only one dependency, a stamp file will be returned
89 // and the rule for the stamp file will be written to the stream. 89 // directly without writing any additional rules.
90 EXPECT_EQ("obj/foo/target.inputdeps.stamp", dep.value()); 90 EXPECT_EQ("obj/foo/base.stamp", dep.value());
91 EXPECT_EQ("build obj/foo/target.inputdeps.stamp: stamp "
92 "../../foo/input.txt obj/foo/base.stamp\n",
93 stream.str());
94 } 91 }
95 92
96 // Input deps for action which should depend on the base since its a hard dep 93 // Input deps for action which should depend on the base since its a hard dep
97 // that is a (indirect) dependency, as well as the the action source. 94 // that is a (indirect) dependency, as well as the the action source.
98 { 95 {
99 std::ostringstream stream; 96 std::ostringstream stream;
100 TestingNinjaTargetWriter writer(&action, setup.toolchain(), stream); 97 TestingNinjaTargetWriter writer(&action, setup.toolchain(), stream);
101 OutputFile dep = 98 OutputFile dep =
102 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>()); 99 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>());
103 100
(...skipping 29 matching lines...) Expand all
133 std::ostringstream stream; 130 std::ostringstream stream;
134 TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream); 131 TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream);
135 OutputFile dep = 132 OutputFile dep =
136 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>()); 133 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>());
137 134
138 // Since there is more than one dependency, a stamp file will be returned 135 // Since there is more than one dependency, a stamp file will be returned
139 // and the rule for the stamp file will be written to the stream. 136 // and the rule for the stamp file will be written to the stream.
140 EXPECT_EQ("obj/foo/setup.stamp", dep.value()); 137 EXPECT_EQ("obj/foo/setup.stamp", dep.value());
141 EXPECT_EQ("", stream.str()); 138 EXPECT_EQ("", stream.str());
142 } 139 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_target_writer.cc ('k') | tools/gn/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698