diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java index 03590c7979..2367da2cf5 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java @@ -97,13 +97,28 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { Assert.fail("Expected error '" + "There is already a built-in attribute 'tags' which cannot be overridden" + "' but got no error"); - } catch (IllegalArgumentException | EvalException e) { + } catch (EvalException e) { assertThat(e).hasMessage( "There is already a built-in attribute 'tags' which cannot be overridden"); } } @Test + public void testCannotOverrideBuiltInAttributeName() throws Exception { + ev.setFailFast(true); + try { + evalAndExport( + "def impl(ctx): return", "r = rule(impl, attrs = {'name': attr.string()})"); + Assert.fail("Expected error '" + + "There is already a built-in attribute 'name' which cannot be overridden" + + "' but got no error"); + } catch (EvalException e) { + assertThat(e).hasMessage( + "There is already a built-in attribute 'name' which cannot be overridden"); + } + } + + @Test public void testImplicitArgsAttribute() throws Exception { evalAndExport( "def _impl(ctx):", |