diff options
author | 2015-11-05 13:51:53 +0000 | |
---|---|---|
committer | 2015-11-05 16:51:58 +0000 | |
commit | a58dcd1d9db64032c2f4c25cb6d14225bc34f065 (patch) | |
tree | 1187bcb9f588bf143905a7ba50d80c75e6d541e7 /src/test/java/com/google/devtools/build/lib/syntax | |
parent | cde721b9623d72e87bf643f6cf3b7dc8d05dc1a7 (diff) |
Improve error message for select objects ('+' operator for incompatible types)
--
MOS_MIGRATED_REVID=107131704
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java | 16 |
1 files changed, 16 insertions, 0 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 5a578e8e27..be1cf6d0db 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 @@ -530,6 +530,22 @@ public class EvaluationTest extends EvaluationTestCase { } @Test + public void testAddSelectIncompatibleType() throws Exception { + newTest() + .testIfErrorContains( + "'+' operator applied to incompatible types (select of list, int)", + "select({'foo': ['FOO'], 'bar': ['BAR']}) + 1"); + } + + @Test + public void testAddSelectIncompatibleType2() throws Exception { + newTest() + .testIfErrorContains( + "'+' operator applied to incompatible types (select of list, select of int)", + "select({'foo': ['FOO']}) + select({'bar': 2})"); + } + + @Test public void testListComprehensionFailsOnNonSequence() throws Exception { newTest().testIfErrorContains("type 'int' is not iterable", "[x + 1 for x in 123]"); } |