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" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class TestingNinjaTargetWriter : public NinjaTargetWriter { | 14 class TestingNinjaTargetWriter : public NinjaTargetWriter { |
15 public: | 15 public: |
16 TestingNinjaTargetWriter(const Target* target, | 16 TestingNinjaTargetWriter(const Target* target, |
17 const Toolchain* toolchain, | 17 const Toolchain* toolchain, |
18 std::ostream& out) | 18 std::ostream& out) |
19 : NinjaTargetWriter(target, out) { | 19 : NinjaTargetWriter(target, out) { |
20 } | 20 } |
21 | 21 |
22 virtual void Run() OVERRIDE {} | 22 virtual void Run() override {} |
23 | 23 |
24 // Make this public so the test can call it. | 24 // Make this public so the test can call it. |
25 OutputFile WriteInputDepsStampAndGetDep( | 25 OutputFile WriteInputDepsStampAndGetDep( |
26 const std::vector<const Target*>& extra_hard_deps) { | 26 const std::vector<const Target*>& extra_hard_deps) { |
27 return NinjaTargetWriter::WriteInputDepsStampAndGetDep(extra_hard_deps); | 27 return NinjaTargetWriter::WriteInputDepsStampAndGetDep(extra_hard_deps); |
28 } | 28 } |
29 }; | 29 }; |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 std::ostringstream stream; | 131 std::ostringstream stream; |
132 TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream); | 132 TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream); |
133 OutputFile dep = | 133 OutputFile dep = |
134 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>()); | 134 writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>()); |
135 | 135 |
136 EXPECT_EQ("obj/foo/target.inputdeps.stamp", dep.value()); | 136 EXPECT_EQ("obj/foo/target.inputdeps.stamp", dep.value()); |
137 EXPECT_EQ("build obj/foo/target.inputdeps.stamp: stamp " | 137 EXPECT_EQ("build obj/foo/target.inputdeps.stamp: stamp " |
138 "obj/foo/setup.stamp\n", | 138 "obj/foo/setup.stamp\n", |
139 stream.str()); | 139 stream.str()); |
140 } | 140 } |
OLD | NEW |