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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "tools/gn/ninja_group_target_writer.h" | 6 #include "tools/gn/ninja_group_target_writer.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 TEST(NinjaGroupTargetWriter, Run) { | 10 TEST(NinjaGroupTargetWriter, Run) { |
| 11 Err err; |
11 TestWithScope setup; | 12 TestWithScope setup; |
12 Err err; | |
13 | 13 |
14 setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/")); | |
15 Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); | 14 Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); |
16 | |
17 target.set_output_type(Target::GROUP); | 15 target.set_output_type(Target::GROUP); |
18 target.visibility().SetPublic(); | 16 target.visibility().SetPublic(); |
19 | 17 |
20 Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); | 18 Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); |
21 dep.set_output_type(Target::ACTION); | 19 dep.set_output_type(Target::ACTION); |
22 dep.visibility().SetPublic(); | 20 dep.visibility().SetPublic(); |
23 dep.SetToolchain(setup.toolchain()); | 21 dep.SetToolchain(setup.toolchain()); |
24 ASSERT_TRUE(dep.OnResolved(&err)); | 22 ASSERT_TRUE(dep.OnResolved(&err)); |
25 | 23 |
26 Target dep2(setup.settings(), Label(SourceDir("//foo/"), "dep2")); | 24 Target dep2(setup.settings(), Label(SourceDir("//foo/"), "dep2")); |
(...skipping 16 matching lines...) Expand all Loading... |
43 ASSERT_TRUE(target.OnResolved(&err)); | 41 ASSERT_TRUE(target.OnResolved(&err)); |
44 | 42 |
45 std::ostringstream out; | 43 std::ostringstream out; |
46 NinjaGroupTargetWriter writer(&target, out); | 44 NinjaGroupTargetWriter writer(&target, out); |
47 writer.Run(); | 45 writer.Run(); |
48 | 46 |
49 const char expected[] = | 47 const char expected[] = |
50 "build obj/foo/bar.stamp: stamp obj/foo/dep.stamp obj/foo/dep2.stamp || ob
j/foo/datadep.stamp\n"; | 48 "build obj/foo/bar.stamp: stamp obj/foo/dep.stamp obj/foo/dep2.stamp || ob
j/foo/datadep.stamp\n"; |
51 EXPECT_EQ(expected, out.str()); | 49 EXPECT_EQ(expected, out.str()); |
52 } | 50 } |
OLD | NEW |