summaryrefslogtreecommitdiff
path: root/tests/basics/while_cond.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-10-17 17:57:33 +0000
committerDamien George <damien.p.george@gmail.com>2014-10-17 17:57:33 +0000
commit391db8669b77e50eebe4d1583749430a3549fab7 (patch)
tree147c05c57016c20ebcbae74db22236cff09d0208 /tests/basics/while_cond.py
parent235f9b33c81e5f60f1d5b975528353bae667007c (diff)
py: Add more compiler optimisations for constant if/while conditions.
Diffstat (limited to 'tests/basics/while_cond.py')
-rw-r--r--tests/basics/while_cond.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/basics/while_cond.py b/tests/basics/while_cond.py
new file mode 100644
index 000000000..449c5b66e
--- /dev/null
+++ b/tests/basics/while_cond.py
@@ -0,0 +1,18 @@
+# test while conditions which are optimised by the compiler
+
+while 0:
+ print(0)
+else:
+ print(1)
+
+while 1:
+ print(2)
+ break
+
+while 2:
+ print(3)
+ break
+
+while -1:
+ print(4)
+ break