diff --git a/NEXT b/NEXT index 47acbf6..d64b229 100644 --- a/NEXT +++ b/NEXT @@ -45,7 +45,7 @@ more on errors: + vm impl -- test cases for assignments inside expr, to demonstrate they are valid ++ test cases for assignments inside expr, to demonstrate they are valid - reflection: allow filling toplevel structs of different types diff --git a/test.py b/test.py index e784000..5ce88a3 100755 --- a/test.py +++ b/test.py @@ -389,6 +389,11 @@ [122.1, f'print {(1<<31)-1}-1', f'{ (1<<31)-2}'], [122.2, f'print -{(1<<31)-1}+1', f'{-(1<<31)+2}'], + + [123.1, 'var a; print "foo"+(a=1); print a', 'foo1\n1'], + [123.2, 'var a; print 2+(a=1); print a', '3\n1'], + [123.3, 'def b{print "foo"+(a=1); print a}', 'foo1\n1'], + [123.4, 'def b{var a; print "foo"+(a=1); print a}', 'foo1\n1'], ] tests_64b = [ diff --git a/testapi_test.go b/testapi_test.go index 0c0a57f..135e83d 100644 --- a/testapi_test.go +++ b/testapi_test.go @@ -381,6 +381,10 @@ func TestInterpretFromPy(t *testing.T) { {`121.2`, `print 1/0.0`, "+Inf", false, false, ""}, {`122.1`, `print 2147483647-1`, "2147483646", false, false, ""}, {`122.2`, `print -2147483647+1`, "-2147483646", false, false, ""}, + {`123.1`, `var a; print "foo"+(a=1); print a`, "foo1\n1", false, false, ""}, + {`123.2`, `var a; print 2+(a=1); print a`, "3\n1", false, false, ""}, + {`123.3`, `def b{print "foo"+(a=1); print a}`, "foo1\n1", false, false, ""}, + {`123.4`, `def b{var a; print "foo"+(a=1); print a}`, "foo1\n1", false, false, ""}, {`122.1-64`, `print 9223372036854775807-1`, "9223372036854775806", false, false, ""}, {`122.2-64`, `print -9223372036854775807+1`, "-9223372036854775806", false, false, ""}, }