From c31f351a191d6927a6483384826297e5549cf426 Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Thu, 29 Dec 2016 21:41:33 +0000 Subject: Cleanup in error messages, try to improve consistency. -- PiperOrigin-RevId: 143204724 MOS_MIGRATED_REVID=143204724 --- .../lib/skylark/SkylarkRuleClassFunctionsTest.java | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java') 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 type for 'attrs' but got instead", + "expected type for 'attrs' but got 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 -- cgit v1.2.3