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/err.h" | 8 #include "tools/gn/err.h" |
9 #include "tools/gn/escape.h" | 9 #include "tools/gn/escape.h" |
10 #include "tools/gn/substitution_list.h" | 10 #include "tools/gn/substitution_list.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( | 183 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( |
184 &target, SUBSTITUTION_LABEL, &result)); | 184 &target, SUBSTITUTION_LABEL, &result)); |
185 EXPECT_EQ("//foo/bar:baz", result); | 185 EXPECT_EQ("//foo/bar:baz", result); |
186 | 186 |
187 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( | 187 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( |
188 &target, SUBSTITUTION_ROOT_GEN_DIR, &result)); | 188 &target, SUBSTITUTION_ROOT_GEN_DIR, &result)); |
189 EXPECT_EQ("gen", result); | 189 EXPECT_EQ("gen", result); |
190 | 190 |
191 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( | 191 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( |
192 &target, SUBSTITUTION_ROOT_OUT_DIR, &result)); | 192 &target, SUBSTITUTION_ROOT_OUT_DIR, &result)); |
193 EXPECT_EQ("", result); | 193 EXPECT_EQ(".", result); |
194 | 194 |
195 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( | 195 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( |
196 &target, SUBSTITUTION_TARGET_GEN_DIR, &result)); | 196 &target, SUBSTITUTION_TARGET_GEN_DIR, &result)); |
197 EXPECT_EQ("gen/foo/bar", result); | 197 EXPECT_EQ("gen/foo/bar", result); |
198 | 198 |
199 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( | 199 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( |
200 &target, SUBSTITUTION_TARGET_OUT_DIR, &result)); | 200 &target, SUBSTITUTION_TARGET_OUT_DIR, &result)); |
201 EXPECT_EQ("obj/foo/bar", result); | 201 EXPECT_EQ("obj/foo/bar", result); |
202 | 202 |
203 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( | 203 EXPECT_TRUE(SubstitutionWriter::GetTargetSubstitution( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 // Test that we handle paths that end up in the root build dir properly | 247 // Test that we handle paths that end up in the root build dir properly |
248 // (no leading "./" or "/"). | 248 // (no leading "./" or "/"). |
249 Err err; | 249 Err err; |
250 SubstitutionPattern pattern; | 250 SubstitutionPattern pattern; |
251 ASSERT_TRUE( | 251 ASSERT_TRUE( |
252 pattern.Parse("{{root_out_dir}}/{{target_output_name}}.so", NULL, &err)); | 252 pattern.Parse("{{root_out_dir}}/{{target_output_name}}.so", NULL, &err)); |
253 | 253 |
254 OutputFile output = SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( | 254 OutputFile output = SubstitutionWriter::ApplyPatternToLinkerAsOutputFile( |
255 &target, tool, pattern); | 255 &target, tool, pattern); |
256 EXPECT_EQ("libbaz.so", output.value()); | 256 EXPECT_EQ("./libbaz.so", output.value()); |
257 } | 257 } |
OLD | NEW |