diff options
author | cparsons <cparsons@google.com> | 2018-03-22 14:49:22 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-22 14:50:38 -0700 |
commit | 0446f99c4b0f9739aca53826ae3e32555fcf47a6 (patch) | |
tree | 681aea0c7ab4d631814b75efc6d5eb284818aae1 /src/test/java/com/google/devtools/build/lib/skylark | |
parent | 8402a23a5432e363d3c09bae0b020abb35e7f468 (diff) |
Convert several SkylarkAttr methods to use @SkylarkCallable instead of @SkylarkSignature
RELNOTES: None.
PiperOrigin-RevId: 190129404
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark')
2 files changed, 16 insertions, 11 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 9ad90deb6a..6f6a561d84 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 @@ -430,7 +430,8 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testNonLabelAttrWithProviders() throws Exception { checkErrorContains( - "unexpected keyword 'providers' in call to string", "attr.string(providers = ['a'])"); + "unexpected keyword 'providers', in method call string(list providers)", + "attr.string(providers = ['a'])"); } private static final RuleClass.ConfiguredTargetFactory<Object, Object, Exception> @@ -499,8 +500,8 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testAttrDefaultValueBadType() throws Exception { checkErrorContains( - "argument 'default' has type 'int', but should be 'string'\n" - + "in call to builtin function attr.string(*, default, doc, mandatory, values)", + "expected value of type 'string' for parameter 'default', " + + "in method call string(int default) of 'attr (a language module)'", "attr.string(default = 1)"); } @@ -528,7 +529,9 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testAttrBadKeywordArguments() throws Exception { checkErrorContains( - "unexpected keyword 'bad_keyword' in call to string", "attr.string(bad_keyword = '')"); + "unexpected keyword 'bad_keyword', in method call string(string bad_keyword) " + + "of 'attr (a language module)'", + "attr.string(bad_keyword = '')"); } @Test @@ -588,8 +591,8 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testAttrDocValueBadType() throws Exception { checkErrorContains( - "argument 'doc' has type 'int', but should be 'string'\n" - + "in call to builtin function attr.string(*, default, doc, mandatory, values)", + "expected value of type 'string' for parameter 'doc', " + + "in method call string(int doc) of 'attr (a language module)'", "attr.string(doc = 1)"); } @@ -608,8 +611,8 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testLateBoundAttrWorksWithOnlyLabel() throws Exception { checkEvalError( - "argument 'default' has type 'function', but should be 'string'\n" - + "in call to builtin function attr.string(*, default, doc, mandatory, values)", + "expected value of type 'string' for parameter 'default', " + + "in method call string(function default) of 'attr (a language module)'", "def attr_value(cfg): return 'a'", "attr.string(default=attr_value)"); } @@ -911,8 +914,9 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testLabelAttrWrongDefault() throws Exception { checkErrorContains( - "expected value of type 'string' for parameter 'default' of attribute 'label', " - + "but got 123 (int)", + "expected value of type 'Label or string or SkylarkLateBoundDefault or " + + "function or NoneType' for parameter 'default', in method call " + + "label(int default) of 'attr (a language module)'", "attr.label(default = 123)"); } diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java index 43073e9342..40744c893f 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java @@ -2195,7 +2195,8 @@ public class SkylarkRuleImplementationFunctionsTest extends SkylarkTestCase { assertThrows(AssertionError.class, () -> getConfiguredTarget("//test:main")); assertThat(expected).hasMessageThat() - .contains("argument 'default' has type 'SkylarkLateBoundDefault', but should be 'int'"); + .contains("expected value of type 'int or function' for parameter 'default', " + + "in method call int(SkylarkLateBoundDefault default)"); } private void setupThrowFunction(BuiltinFunction func) throws Exception { |