aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/syntax
diff options
context:
space:
mode:
authorGravatar Laurent Le Brun <laurentlb@google.com>2015-11-05 13:51:53 +0000
committerGravatar John Field <jfield@google.com>2015-11-05 16:51:58 +0000
commita58dcd1d9db64032c2f4c25cb6d14225bc34f065 (patch)
tree1187bcb9f588bf143905a7ba50d80c75e6d541e7 /src/test/java/com/google/devtools/build/lib/syntax
parentcde721b9623d72e87bf643f6cf3b7dc8d05dc1a7 (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.java16
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]");
}