diff options
author | Laurent Le Brun <laurentlb@google.com> | 2017-03-02 14:12:53 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-03-03 10:35:18 +0000 |
commit | 83514648f2e4e63dcd039e976f3b5d47552e0383 (patch) | |
tree | e14c5bed02180977a1eefb61cfe4f5f3ef30be59 /src/test | |
parent | 69a127b8f4e353ecb163688ed3271fb47e0f385d (diff) |
Improve error message for the 'in' operator.
In particular, display the type that was passed as argument.
--
PiperOrigin-RevId: 148995695
MOS_MIGRATED_REVID=148995695
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java | 7 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java | 9 |
2 files changed, 3 insertions, 13 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java index f217591bb8..0f2a2cbb17 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java @@ -673,10 +673,9 @@ public class EvaluationTest extends EvaluationTestCase { @Test public void testInFail() throws Exception { newTest() - .testIfExactError( - "in operator only works on strings if the left operand is also a string", "1 in '123'") - .testIfExactError( - "in operator only works on lists, tuples, sets, dicts and strings", "'a' in 1"); + .testIfErrorContains( + "'in <string>' requires string as left operand, not 'int'", "1 in '123'") + .testIfErrorContains("'int' is not iterable. in operator only works on ", "'a' in 1"); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java index 6353c1270e..a72f5e5a91 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java @@ -1243,15 +1243,6 @@ public class SkylarkEvaluationTest extends EvaluationTest { @Override @Test - public void testInFail() throws Exception { - new SkylarkTest().testIfExactError( - "in operator only works on strings if the left operand is also a string", "1 in '123'"); - new SkylarkTest().testIfExactError( - "in operator only works on lists, tuples, sets, dicts and strings", "'a' in 1"); - } - - @Override - @Test public void testListComprehensionsMultipleVariablesFail() throws Exception { new SkylarkTest() .testIfErrorContains( |