summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-11 17:40:41 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-11 17:40:41 +0000
commit5fba93a26b6f09c20391ec18b281def2bd851650 (patch)
treeabcd31b69657e7b605e11e233dd1680f8b00fe52
parentc33ce606cf9c374b6cbe97fe39461ad7d500bb7f (diff)
downloadmicropython-5fba93a26b6f09c20391ec18b281def2bd851650.tar.gz
micropython-5fba93a26b6f09c20391ec18b281def2bd851650.zip
tests: Add test for semantics of for-loop that optimisation can break.
-rw-r--r--tests/basics/for3.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/basics/for3.py b/tests/basics/for3.py
new file mode 100644
index 0000000000..ffa1be2444
--- /dev/null
+++ b/tests/basics/for3.py
@@ -0,0 +1,11 @@
+# test assigning to iterator within the loop
+for i in range(2):
+ print(i)
+ i = 2
+
+# test assigning to range parameter within the loop
+# (since we optimise for loops, this needs checking, currently it fails)
+#n = 2
+#for i in range(n):
+# print(i)
+# n = 0