| Index: tools/gn/target_unittest.cc
|
| diff --git a/tools/gn/target_unittest.cc b/tools/gn/target_unittest.cc
|
| index ef213b5286fa9d1ab9a064182280e742a057ea79..860dcaf1b0d4e36550c9dae7cd17775f20a8a064 100644
|
| --- a/tools/gn/target_unittest.cc
|
| +++ b/tools/gn/target_unittest.cc
|
| @@ -169,3 +169,33 @@ TEST_F(TargetTest, DependentConfigs) {
|
| ASSERT_EQ(1u, a_fwd.all_dependent_configs().size());
|
| EXPECT_EQ(&all, a_fwd.all_dependent_configs()[0].ptr);
|
| }
|
| +
|
| +// Tests that forward_dependent_configs_from works for groups, forwarding the
|
| +// group's deps' dependent configs.
|
| +TEST_F(TargetTest, ForwardDependentConfigsFromGroups) {
|
| + Target a(&settings_, Label(SourceDir("//foo/"), "a"));
|
| + a.set_output_type(Target::EXECUTABLE);
|
| + Target b(&settings_, Label(SourceDir("//foo/"), "b"));
|
| + b.set_output_type(Target::GROUP);
|
| + Target c(&settings_, Label(SourceDir("//foo/"), "c"));
|
| + c.set_output_type(Target::STATIC_LIBRARY);
|
| + a.deps().push_back(LabelTargetPair(&b));
|
| + b.deps().push_back(LabelTargetPair(&c));
|
| +
|
| + // Direct dependent config on C.
|
| + Config direct(&settings_, Label(SourceDir("//foo/"), "direct"));
|
| + c.direct_dependent_configs().push_back(LabelConfigPair(&direct));
|
| +
|
| + // A forwards the dependent configs from B.
|
| + a.forward_dependent_configs().push_back(LabelTargetPair(&b));
|
| +
|
| + c.OnResolved();
|
| + b.OnResolved();
|
| + a.OnResolved();
|
| +
|
| + // The config should now be on A, and in A's direct dependent configs.
|
| + ASSERT_EQ(1u, a.configs().size());
|
| + ASSERT_EQ(&direct, a.configs()[0].ptr);
|
| + ASSERT_EQ(1u, a.direct_dependent_configs().size());
|
| + ASSERT_EQ(&direct, a.direct_dependent_configs()[0].ptr);
|
| +}
|
|
|