refactor: move benchmark directory under test and update all references

The benchmark directory is relocated from the project root into the test directory, and all scripts, documentation links, and gitignore paths are updated accordingly. The test runner is also refactored to explicitly walk subdirectories (core, io, language, limit) instead of using a single test root, and a new test/README.md is added to document the test suite structure. Additionally, the constructor test for the Foo class is updated to add a zero-arity constructor and adjust expected output strings.
This commit is contained in:
Bob Nystrom
2015-03-14 19:45:56 +00:00
parent af58528e88
commit c4ef964f92
562 changed files with 32 additions and 8 deletions
@@ -0,0 +1,10 @@
var list = []
for (i in [1, 2, 3]) {
list.add(new Fn { IO.print(i) })
}
for (f in list) f.call()
// expect: 1
// expect: 2
// expect: 3
+11
View File
@@ -0,0 +1,11 @@
var list = []
for (i in [1, 2, 3]) {
var j = i + 1
list.add(new Fn { IO.print(j) })
}
for (f in list) f.call()
// expect: 2
// expect: 3
// expect: 4
+2
View File
@@ -0,0 +1,2 @@
for // expect error
(i in [1, 2, 3]) IO.print(i)
+2
View File
@@ -0,0 +1,2 @@
for (i // expect error
in [1]) IO.print(i)
@@ -0,0 +1,10 @@
var f = new Fn {
IO.print("evaluate sequence")
return [1, 2, 3]
}
for (i in f.call()) IO.print(i)
// expect: evaluate sequence
// expect: 1
// expect: 2
// expect: 3
+9
View File
@@ -0,0 +1,9 @@
var f = new Fn {
for (i in [1, 2, 3]) {
return new Fn { IO.print(i) }
}
}
var g = f.call()
g.call()
// expect: 1
+8
View File
@@ -0,0 +1,8 @@
var f = new Fn {
for (i in [1, 2, 3]) {
return i
}
}
IO.print(f.call())
// expect: 1
+14
View File
@@ -0,0 +1,14 @@
// Single-expression body.
for (i in [1]) IO.print(i)
// expect: 1
// Block body.
for (i in [1]) {
IO.print(i)
}
// expect: 1
// Newline after "in".
for (i in
[1]) IO.print(i)
// expect: 1
+32
View File
@@ -0,0 +1,32 @@
class Iter {
new(value) { _value = value }
iterate(iterator) { _value }
iteratorValue(iterator) { "value" }
}
// False and null are false.
for (n in new Iter(false)) {
IO.print("bad")
break
}
for (n in new Iter(null)) {
IO.print("bad")
break
}
// Everything else is true.
for (n in new Iter(true)) {
IO.print("true") // expect: true
break
}
for (n in new Iter(0)) {
IO.print(0) // expect: 0
break
}
for (n in new Iter("")) {
IO.print("string") // expect: string
break
}