summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorandrewc <andrew_chambers@trimble.com>2016-01-20 15:13:42 +1300
committerandrewc <andrew_chambers@trimble.com>2016-01-20 15:19:51 +1300
commit8eef2702d6533ca399758c38acedf0f086b93e13 (patch)
tree62b8e4a86074caeb4820ef56b98083d1c8dbd8bf /test
parentd73d54388b6c16e61ecceecb21a3df258f33c434 (diff)
downloadmc-8eef2702d6533ca399758c38acedf0f086b93e13.tar.gz
fix decl for with no cond and add more tests
Diffstat (limited to 'test')
-rw-r--r--test/fornocond.myr14
-rw-r--r--test/foroptexpr.myr65
-rw-r--r--test/tests2
3 files changed, 66 insertions, 15 deletions
diff --git a/test/fornocond.myr b/test/fornocond.myr
deleted file mode 100644
index 7c43d38..0000000
--- a/test/fornocond.myr
+++ /dev/null
@@ -1,14 +0,0 @@
-use std
-
-const main = {
- var i
-
- for i = 0; ; i++
- if i == 10
- break;
- ;;
- ;;
- if i == 10
- std.put("pass\n")
- ;;
-}
diff --git a/test/foroptexpr.myr b/test/foroptexpr.myr
new file mode 100644
index 0000000..2f56727
--- /dev/null
+++ b/test/foroptexpr.myr
@@ -0,0 +1,65 @@
+use std
+
+const main = {
+ var i
+
+ for i = 0; ; i++
+ if i == 10
+ break
+ ;;
+ ;;
+ if i != 10
+ std.exit(1)
+ ;;
+
+ i = 0
+ for var j = 0; ; j++
+ if j == 10
+ break
+ ;;
+ i++
+ ;;
+ if i != 10
+ std.exit(2)
+ ;;
+
+ i = 0
+ for ; ;
+ i++
+ if i == 10
+ break
+ ;;
+ ;;
+ if i != 10
+ std.exit(3)
+ ;;
+
+ i = 0
+ for ; i < 10;
+ i++
+ ;;
+ if i != 10
+ std.exit(4)
+ ;;
+
+ for i = 0 ; ;
+ if i == 10
+ break
+ ;;
+ i++
+ ;;
+ if i != 10
+ std.exit(5)
+ ;;
+
+ i = 0
+ for ; ; i++
+ if i == 10
+ break
+ ;;
+ ;;
+ if i != 10
+ std.exit(6)
+ ;;
+ std.put("pass\n")
+}
diff --git a/test/tests b/test/tests
index 3594238..28775e6 100644
--- a/test/tests
+++ b/test/tests
@@ -149,4 +149,4 @@ F aritylow
F arityhigh
F badop
B voideffect P pass
-B fornocond P pass
+B foroptexpr P pass