OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |