diff options
author | 2015-06-17 16:02:16 +0000 | |
---|---|---|
committer | 2015-06-18 10:01:29 +0000 | |
commit | 88014fe2a1e760c21440e6952e871186cbd3f956 (patch) | |
tree | 69664dfc4107cd720529d18612ffddacc5075e16 /src/test/java/com/google/devtools/build/lib/syntax | |
parent | 13ef26d0817a429bf214d3dc4c5551e616e403fe (diff) |
Skylark: Allow variable reassignment to change the type of a variable.
--
MOS_MIGRATED_REVID=96211360
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java | 11 |
1 files changed, 11 insertions, 0 deletions
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 3dcbb9d4d2..cc0e4aaf6c 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 @@ -469,6 +469,17 @@ public class SkylarkEvaluationTest extends EvaluationTest { } @Test + public void testReassignment() throws Exception { + eval("def foo(x=None):", + " x = 1", + " x = [1, 2]", + " x = 'str'", + " return x", + "s = foo()"); + assertThat(lookup("s")).isEqualTo("str"); + } + + @Test public void testJavaCalls() throws Exception { update("mock", new Mock()); eval("b = mock.is_empty('a')"); |