Reorganize tests and benchmark scripts.
Mainly to get rid of one top level directory. But this will also be useful when there are tests of the embedding API.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
var list = []
|
||||
|
||||
var i = 1
|
||||
while (i < 4) {
|
||||
var j = i + 1
|
||||
list.add(new Fn { IO.print(j) })
|
||||
i = i + 1
|
||||
}
|
||||
|
||||
for (f in list) f.call()
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
// expect: 4
|
||||
@@ -0,0 +1,2 @@
|
||||
while // expect error
|
||||
(true) IO.print("bad")
|
||||
@@ -0,0 +1,10 @@
|
||||
var f = new Fn {
|
||||
while (true) {
|
||||
var i = "i"
|
||||
return new Fn { IO.print(i) }
|
||||
}
|
||||
}
|
||||
|
||||
var g = f.call()
|
||||
g.call()
|
||||
// expect: i
|
||||
@@ -0,0 +1,9 @@
|
||||
var f = new Fn {
|
||||
while (true) {
|
||||
var i = "i"
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
IO.print(f.call())
|
||||
// expect: i
|
||||
@@ -0,0 +1,16 @@
|
||||
// Single-expression body.
|
||||
var c = 0
|
||||
while (c < 3) IO.print(c = c + 1)
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
|
||||
// Block body.
|
||||
var a = 0
|
||||
while (a < 3) {
|
||||
IO.print(a)
|
||||
a = a + 1
|
||||
}
|
||||
// expect: 0
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
@@ -0,0 +1,26 @@
|
||||
// False and null are false.
|
||||
while (false) {
|
||||
IO.print("bad")
|
||||
break
|
||||
}
|
||||
|
||||
while (null) {
|
||||
IO.print("bad")
|
||||
break
|
||||
}
|
||||
|
||||
// Everything else is true.
|
||||
while (true) {
|
||||
IO.print("true") // expect: true
|
||||
break
|
||||
}
|
||||
|
||||
while (0) {
|
||||
IO.print(0) // expect: 0
|
||||
break
|
||||
}
|
||||
|
||||
while ("") {
|
||||
IO.print("string") // expect: string
|
||||
break
|
||||
}
|
||||
Reference in New Issue
Block a user