aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java10
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java5
2 files changed, 4 insertions, 11 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 fb438a6e70..ae21bee88a 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
@@ -406,12 +406,10 @@ public class EvaluationTest extends EvaluationTestCase {
}
@Test
- public void testListComprehensionModifiesGlobalEnv() throws Exception {
- new SkylarkTest()
- .update("x", 42)
- .testIfErrorContains("Variable x is read only", "[x + 1 for x in [1,2,3]]");
- new BuildTest().update("x", 42).setUp("y =[x + 1 for x in [1,2,3]]")
- .testExactOrder("y", 2, 3, 4).testLookup("x", 3); // (x is global)
+ public void testListComprehensionAtTopLevel() throws Exception {
+ // It is allowed to have a loop variable with the same name as a global variable.
+ newTest().update("x", 42).setUp("y = [x + 1 for x in [1,2,3]]")
+ .testExactOrder("y", 2, 3, 4);
}
@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 e27cb6372f..7ab15c9d87 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
@@ -1384,11 +1384,6 @@ public class SkylarkEvaluationTest extends EvaluationTest {
+ "evaluates to value of length 2",
"[x + y for x, y, z in [(1, 2), (3, 4)]]");
- // can't reuse the same local variable twice(!)
- new SkylarkTest()
- .testIfErrorContains(
- "Variable x is read only", "[x + y for x, y in (1, 2)]", "[x + y for x, y in (1, 2)]");
-
new SkylarkTest()
.testIfErrorContains("type 'int' is not a collection", "[x2 + y2 for x2, y2 in (1, 2)]");