aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java
index c17cd69f12..44eff26e7f 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkAspectsTest.java
@@ -1744,6 +1744,32 @@ public class SkylarkAspectsTest extends AnalysisTestCase {
assertThat(analysisResult.hasError()).isFalse();
}
+ @Test
+ public void aspectAdvertisingProviders() throws Exception {
+ scratch.file(
+ "test/aspect.bzl",
+ "def _impl(target, ctx):",
+ " return struct()",
+ "my_aspect = aspect(_impl, provides = ['foo'])",
+ "a_dict = { 'foo' : attr.label_list(aspects = [my_aspect]) }"
+ );
+ scratch.file("test/BUILD", "java_library(name = 'xxx',)");
+
+ reporter.removeHandler(failFastHandler);
+ try {
+ AnalysisResult analysisResult = update(
+ ImmutableList.of("//test:aspect.bzl%my_aspect"),
+ "//test:xxx");
+ assertThat(keepGoing()).isTrue();
+ assertThat(analysisResult.hasError()).isTrue();
+ } catch (ViewCreationFailedException e) {
+ // expect exception
+ }
+ assertContainsEvent(
+ "Aspect '//test:aspect.bzl%my_aspect', applied to '//test:xxx', "
+ + "does not provide advertised provider 'foo'");
+ }
+
@RunWith(JUnit4.class)
public static final class WithKeepGoing extends SkylarkAspectsTest {
@Override