diff options
author | 2016-12-29 21:41:33 +0000 | |
---|---|---|
committer | 2017-01-03 15:02:44 +0000 | |
commit | c31f351a191d6927a6483384826297e5549cf426 (patch) | |
tree | 1b65b2caf884254917d6c0059f88f3e1dfce9d44 /src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java | |
parent | ccb78ec8a0ba777ad9f121de95e553791fa9c617 (diff) |
Cleanup in error messages, try to improve consistency.
--
PiperOrigin-RevId: 143204724
MOS_MIGRATED_REVID=143204724
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java | 30 |
1 files changed, 15 insertions, 15 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 69783f215f..682d9877a4 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 @@ -245,11 +245,13 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testAttrWithWrongProvidersList() throws Exception { - checkErrorContains("Illegal argument: element in 'providers' is of unexpected type." + checkErrorContains( + "element in 'providers' is of unexpected type." + " Should be list of string, but got list with an element of type int.", "attr.label_list(allow_files = True, providers = [['a', 1], ['c']])"); - checkErrorContains("Illegal argument: element in 'providers' is of unexpected type." + checkErrorContains( + "element in 'providers' is of unexpected type." + " Should be list of string, but got string.", "attr.label_list(allow_files = True, providers = [['a', 'b'], 'c'])"); } @@ -270,12 +272,11 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testLabelListWithAspectsError() throws Exception { checkErrorContains( - "Illegal argument: expected type Aspect for 'aspects' element but got type int instead", + "expected type 'Aspect' for 'aspects' element but got type 'int' instead", "def _impl(target, ctx):", " pass", "my_aspect = aspect(implementation = _impl)", - "attr.label_list(aspects = [my_aspect, 123])" - ); + "attr.label_list(aspects = [my_aspect, 123])"); } @Test @@ -392,9 +393,9 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testAttrDefaultValueBadType() throws Exception { checkErrorContains( - "Method attr.string(*, default: string, mandatory: bool, values: sequence of strings) " - + "is not applicable for arguments (int, bool, list): 'default' is int, " - + "but should be string", + "method attr.string(*, default: string, mandatory: bool, values: sequence of strings) " + + "is not applicable for arguments (int, bool, list): 'default' is 'int', " + + "but should be 'string'", "attr.string(default = 1)"); } @@ -469,9 +470,9 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testLateBoundAttrWorksWithOnlyLabel() throws Exception { checkEvalError( - "Method attr.string(*, default: string, mandatory: bool, values: sequence of strings) " - + "is not applicable for arguments (function, bool, list): 'default' is function, " - + "but should be string", + "method attr.string(*, default: string, mandatory: bool, values: sequence of strings) " + + "is not applicable for arguments (function, bool, list): 'default' is 'function', " + + "but should be 'string'", "def attr_value(cfg): return 'a'", "attr.string(default=attr_value)"); } @@ -558,8 +559,7 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { public void testRuleBadTypeInAdd() throws Exception { registerDummyUserDefinedFunction(); checkErrorContains( - "Illegal argument: " - + "expected <String, Descriptor> type for 'attrs' but got <string, string> instead", + "expected <String, Descriptor> type for 'attrs' but got <string, string> instead", "rule(impl, attrs = {'a1': 'some text'})"); } @@ -908,8 +908,8 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testGetattrNoAttr() throws Exception { - checkErrorContains("Object of type 'struct' has no attribute \"b\"", - "s = struct(a='val')", "getattr(s, 'b')"); + checkErrorContains( + "object of type 'struct' has no attribute \"b\"", "s = struct(a='val')", "getattr(s, 'b')"); } @Test |