use of com.google.devtools.build.lib.skylarkinterface.SkylarkCallable in project bazel by bazelbuild.
the class SkylarkInterfaceUtilsTest method testGetSkylarkCallableTwoargForm.
@Test
public void testGetSkylarkCallableTwoargForm() throws Exception {
// Ensure that when passing superclass in directly, we bypass subclass's annotation.
Method method = MockClassC.class.getMethod("foo");
SkylarkCallable ann = SkylarkInterfaceUtils.getSkylarkCallable(MockClassA.class, method);
assertThat(ann).isNotNull();
assertThat(ann.doc()).isEqualTo("MockClassA#foo");
}
use of com.google.devtools.build.lib.skylarkinterface.SkylarkCallable in project bazel by bazelbuild.
the class SkylarkInterfaceUtilsTest method testGetSkylarkCallableInterface.
@Test
public void testGetSkylarkCallableInterface() throws Exception {
// Search through parent interfaces. First interface takes priority.
Method method = MockClassC.class.getMethod("baz");
SkylarkCallable ann = SkylarkInterfaceUtils.getSkylarkCallable(method);
assertThat(ann).isNotNull();
assertThat(ann.doc()).isEqualTo("MockInterfaceB1#baz");
// Make sure both are still traversed.
method = MockClassC.class.getMethod("qux");
ann = SkylarkInterfaceUtils.getSkylarkCallable(method);
assertThat(ann).isNotNull();
assertThat(ann.doc()).isEqualTo("MockInterfaceB2#qux");
}
Aggregations