Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "tools/gn/target.h" | 5 #include "tools/gn/target.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "tools/gn/build_settings.h" | 10 #include "tools/gn/build_settings.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 EXPECT_EQ("bar", with_prefix.GetComputedOutputName(false)); | 287 EXPECT_EQ("bar", with_prefix.GetComputedOutputName(false)); |
| 288 EXPECT_EQ("libbar", with_prefix.GetComputedOutputName(true)); | 288 EXPECT_EQ("libbar", with_prefix.GetComputedOutputName(true)); |
| 289 | 289 |
| 290 // Target with a "lib" prefix that already has it applied. The prefix should | 290 // Target with a "lib" prefix that already has it applied. The prefix should |
| 291 // not duplicate something already in the target name. | 291 // not duplicate something already in the target name. |
| 292 TestTarget dup_prefix(setup, "//foo:bar", Target::STATIC_LIBRARY); | 292 TestTarget dup_prefix(setup, "//foo:bar", Target::STATIC_LIBRARY); |
| 293 dup_prefix.set_output_name("libbar"); | 293 dup_prefix.set_output_name("libbar"); |
| 294 ASSERT_TRUE(dup_prefix.OnResolved(&err)); | 294 ASSERT_TRUE(dup_prefix.OnResolved(&err)); |
| 295 EXPECT_EQ("libbar", dup_prefix.GetComputedOutputName(false)); | 295 EXPECT_EQ("libbar", dup_prefix.GetComputedOutputName(false)); |
| 296 EXPECT_EQ("libbar", dup_prefix.GetComputedOutputName(true)); | 296 EXPECT_EQ("libbar", dup_prefix.GetComputedOutputName(true)); |
| 297 | |
| 298 // Target with an output prefix override should not a prefix. | |
|
Dirk Pranke
2016/04/07 21:43:54
nit: s/should not a/should not have a/
| |
| 299 TestTarget override_prefix(setup, "//foo:bar", Target::SHARED_LIBRARY); | |
| 300 override_prefix.set_output_prefix_override(true); | |
| 301 ASSERT_TRUE(dup_prefix.OnResolved(&err)); | |
| 302 EXPECT_EQ("bar", override_prefix.GetComputedOutputName(false)); | |
| 303 EXPECT_EQ("bar", override_prefix.GetComputedOutputName(true)); | |
| 297 } | 304 } |
| 298 | 305 |
| 299 // Test visibility failure case. | 306 // Test visibility failure case. |
| 300 TEST(Target, VisibilityFails) { | 307 TEST(Target, VisibilityFails) { |
| 301 TestWithScope setup; | 308 TestWithScope setup; |
| 302 Err err; | 309 Err err; |
| 303 | 310 |
| 304 TestTarget b(setup, "//private:b", Target::STATIC_LIBRARY); | 311 TestTarget b(setup, "//private:b", Target::STATIC_LIBRARY); |
| 305 b.visibility().SetPrivate(b.label().dir()); | 312 b.visibility().SetPrivate(b.label().dir()); |
| 306 ASSERT_TRUE(b.OnResolved(&err)); | 313 ASSERT_TRUE(b.OnResolved(&err)); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 ASSERT_EQ(c.bundle_data().file_rules().size(), 1u); | 881 ASSERT_EQ(c.bundle_data().file_rules().size(), 1u); |
| 875 ASSERT_EQ(c.bundle_data().file_rules()[0].sources().size(), 1u); | 882 ASSERT_EQ(c.bundle_data().file_rules()[0].sources().size(), 1u); |
| 876 ASSERT_EQ(c.bundle_data().bundle_deps().size(), 1u); | 883 ASSERT_EQ(c.bundle_data().bundle_deps().size(), 1u); |
| 877 | 884 |
| 878 // E does not have any bundle_data information but gets a list of | 885 // E does not have any bundle_data information but gets a list of |
| 879 // bundle_deps to propagate them during target resolution. | 886 // bundle_deps to propagate them during target resolution. |
| 880 ASSERT_TRUE(e.bundle_data().file_rules().empty()); | 887 ASSERT_TRUE(e.bundle_data().file_rules().empty()); |
| 881 ASSERT_TRUE(e.bundle_data().asset_catalog_sources().empty()); | 888 ASSERT_TRUE(e.bundle_data().asset_catalog_sources().empty()); |
| 882 ASSERT_EQ(e.bundle_data().bundle_deps().size(), 2u); | 889 ASSERT_EQ(e.bundle_data().bundle_deps().size(), 2u); |
| 883 } | 890 } |
| OLD | NEW |