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/functions.h" | 6 #include "tools/gn/functions.h" |
7 #include "tools/gn/test_with_scope.h" | 7 #include "tools/gn/test_with_scope.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 TEST_F(GetLabelInfoTest, RootGenDir) { | 66 TEST_F(GetLabelInfoTest, RootGenDir) { |
67 EXPECT_EQ("//out/Debug/gen", Call(":name", "root_gen_dir")); | 67 EXPECT_EQ("//out/Debug/gen", Call(":name", "root_gen_dir")); |
68 EXPECT_EQ("//out/Debug/gen", | 68 EXPECT_EQ("//out/Debug/gen", |
69 Call(":name(//toolchain:default)", "root_gen_dir")); | 69 Call(":name(//toolchain:default)", "root_gen_dir")); |
70 EXPECT_EQ("//out/Debug/random/gen", | 70 EXPECT_EQ("//out/Debug/random/gen", |
71 Call(":name(//toolchain:random)", "root_gen_dir")); | 71 Call(":name(//toolchain:random)", "root_gen_dir")); |
72 } | 72 } |
73 | 73 |
74 TEST_F(GetLabelInfoTest, TargetOutDir) { | 74 TEST_F(GetLabelInfoTest, TargetOutDir) { |
75 EXPECT_EQ("//out/Debug/obj/src/foo", Call(":name", "target_out_dir")); | 75 EXPECT_EQ("//out/Debug/obj/src/foo", Call(":name", "target_out_dir")); |
76 EXPECT_EQ("//out/Debug", Call(":name", "root_out_dir")); | |
77 | |
78 EXPECT_EQ("//out/Debug/obj/foo", | 76 EXPECT_EQ("//out/Debug/obj/foo", |
79 Call("//foo:name(//toolchain:default)", "target_out_dir")); | 77 Call("//foo:name(//toolchain:default)", "target_out_dir")); |
80 EXPECT_EQ("//out/Debug/random/obj/foo", | 78 EXPECT_EQ("//out/Debug/random/obj/foo", |
81 Call("//foo:name(//toolchain:random)", "target_out_dir")); | 79 Call("//foo:name(//toolchain:random)", "target_out_dir")); |
82 } | 80 } |
83 | 81 |
| 82 TEST_F(GetLabelInfoTest, TargetGenDir) { |
| 83 EXPECT_EQ("//out/Debug/gen/src/foo", Call(":name", "target_gen_dir")); |
| 84 EXPECT_EQ("//out/Debug/gen/foo", |
| 85 Call("//foo:name(//toolchain:default)", "target_gen_dir")); |
| 86 EXPECT_EQ("//out/Debug/random/gen/foo", |
| 87 Call("//foo:name(//toolchain:random)", "target_gen_dir")); |
| 88 } |
| 89 |
84 TEST_F(GetLabelInfoTest, LabelNoToolchain) { | 90 TEST_F(GetLabelInfoTest, LabelNoToolchain) { |
85 EXPECT_EQ("//src/foo:name", Call(":name", "label_no_toolchain")); | 91 EXPECT_EQ("//src/foo:name", Call(":name", "label_no_toolchain")); |
86 EXPECT_EQ("//src/foo:name", | 92 EXPECT_EQ("//src/foo:name", |
87 Call("//src/foo:name(//toolchain:random)", "label_no_toolchain")); | 93 Call("//src/foo:name(//toolchain:random)", "label_no_toolchain")); |
88 } | 94 } |
89 | 95 |
90 TEST_F(GetLabelInfoTest, LabelWithToolchain) { | 96 TEST_F(GetLabelInfoTest, LabelWithToolchain) { |
91 EXPECT_EQ("//src/foo:name(//toolchain:default)", | 97 EXPECT_EQ("//src/foo:name(//toolchain:default)", |
92 Call(":name", "label_with_toolchain")); | 98 Call(":name", "label_with_toolchain")); |
93 EXPECT_EQ("//src/foo:name(//toolchain:random)", | 99 EXPECT_EQ("//src/foo:name(//toolchain:random)", |
94 Call(":name(//toolchain:random)", "label_with_toolchain")); | 100 Call(":name(//toolchain:random)", "label_with_toolchain")); |
95 } | 101 } |
96 | 102 |
97 TEST_F(GetLabelInfoTest, Toolchain) { | 103 TEST_F(GetLabelInfoTest, Toolchain) { |
98 EXPECT_EQ("//toolchain:default", Call(":name", "toolchain")); | 104 EXPECT_EQ("//toolchain:default", Call(":name", "toolchain")); |
99 EXPECT_EQ("//toolchain:random", | 105 EXPECT_EQ("//toolchain:random", |
100 Call(":name(//toolchain:random)", "toolchain")); | 106 Call(":name(//toolchain:random)", "toolchain")); |
101 } | 107 } |
OLD | NEW |