diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibcTopAliasTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibcTopAliasTest.java index eeb6a9ddddef12..b7d0eaf99bf320 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibcTopAliasTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibcTopAliasTest.java @@ -22,7 +22,7 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Tests for cc_libc_top_alias rule. */ +/** Tests for the {@code cc_libc_top_alias} rule. */ @RunWith(JUnit4.class) public class CcLibcTopAliasTest extends BuildViewTestCase { @@ -35,7 +35,6 @@ public void testCcLibcTopAlias() throws Exception { assertThat(target.getLabel().toString()).isEqualTo("//a:current_cc_libc_top"); } - @Test public void testCcLibcTopAliasWithGrteTopArgument() throws Exception { scratch.file("a/BUILD", "cc_libc_top_alias(name='current_cc_libc_top')"); @@ -51,4 +50,27 @@ public void testCcLibcTopAliasWithGrteTopArgument() throws Exception { assertThat(target.getLabel().toString()).isEqualTo("//b:everything"); } + + @Test + public void aspectOnCcLibcTopAlias() throws Exception { + scratch.file( + "a/defs.bzl", + "def _my_aspect_impl(target, ctx):", + " return []", + "my_aspect = aspect(implementation = _my_aspect_impl)", + "def _apply_aspect_impl(ctx):", + " pass", + "apply_aspect = rule(", + " implementation = _apply_aspect_impl,", + " attrs = {'on': attr.label(aspects = [my_aspect])},", + ")"); + scratch.file( + "a/BUILD", + "load(':defs.bzl', 'apply_aspect')", + "apply_aspect(name = 'apply_aspect', on = ':current_cc_libc_top')", + "cc_libc_top_alias(name = 'current_cc_libc_top')"); + + assertThat(getConfiguredTarget("//a:apply_aspect")).isNotNull(); + assertThat(getAspect("//a:defs.bzl%my_aspect")).isNotNull(); + } }