aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Jon Brandvein <brandjon@google.com>2016-07-25 16:57:54 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-26 09:30:08 +0000
commit79aa7796b957c864e8ee7f5ce4c361bc1c4347e7 (patch)
treef97fb72d9767097b7a4c3a6dcc071a5ad37de2d1 /src/test/java/com/google/devtools/build/lib
parent7cf2460a0c2908938f75b5284c0d8e2a0a48e1dc (diff)
Fix crash when updating collections while iterating over them in comprehensions
This makes For clauses have the same semantics as For loops. -- MOS_MIGRATED_REVID=128368124
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java9
1 files changed, 9 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 4396608f66..78f9962d74 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
@@ -575,6 +575,15 @@ public class EvaluationTest extends EvaluationTestCase {
}
@Test
+ public void testListComprehensionUpdate() throws Exception {
+ new BuildTest()
+ .setUp("xs = [1, 2, 3]")
+ .testStatement("[xs.append(4) for x in xs]",
+ MutableList.of(env, Runtime.NONE, Runtime.NONE, Runtime.NONE))
+ .testLookup("xs", MutableList.of(env, 1, 2, 3));
+ }
+
+ @Test
public void testInOperator() throws Exception {
newTest()
.testStatement("'b' in ['a', 'b']", Boolean.TRUE)