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,25 @@
var f = null
var g = null
{
var local = "local"
f = new Fn {
IO.print(local)
local = "after f"
IO.print(local)
}
g = new Fn {
IO.print(local)
local = "after g"
IO.print(local)
}
}
f.call()
// expect: local
// expect: after f
g.call()
// expect: after f
// expect: after g
@@ -0,0 +1,9 @@
var f = null
new Fn {|param|
f = new Fn {
IO.print(param)
}
}.call("param")
f.call() // expect: param
@@ -0,0 +1,13 @@
// This is a regression test. There was a bug where if an upvalue for an
// earlier local (here "a") was captured *after* a later one ("b"), then Wren
// would crash because it walked to the end of the upvalue list (correct), but
// then didn't handle not finding the variable.
new Fn {
var a = "a"
var b = "b"
new Fn {
IO.print(b) // expect: b
IO.print(a) // expect: a
}.call()
}.call()
@@ -0,0 +1,12 @@
var F = null
class Foo {
method(param) {
F = new Fn {
IO.print(param)
}
}
}
(new Foo).method("param")
F.call() // expect: param
@@ -0,0 +1,10 @@
var f = null
{
var local = "local"
f = new Fn {
IO.print(local)
}
}
f.call() // expect: local
@@ -0,0 +1,14 @@
var foo = null
{
var local = "local"
class Foo {
method {
IO.print(local)
}
}
foo = new Foo
}
foo.method // expect: local
+21
View File
@@ -0,0 +1,21 @@
var f = null
new Fn {
var a = "a"
new Fn {
var b = "b"
new Fn {
var c = "c"
f = new Fn {
IO.print(a)
IO.print(b)
IO.print(c)
}
}.call()
}.call()
}.call()
f.call()
// expect: a
// expect: b
// expect: c
@@ -0,0 +1,6 @@
{
var local = "local"
new Fn {
IO.print(local) // expect: local
}.call()
}
@@ -0,0 +1,10 @@
{
var local = "local"
class Foo {
method {
IO.print(local)
}
}
(new Foo).method // expect: local
}
@@ -0,0 +1,13 @@
var f = null
{
var a = "a"
f = new Fn {
IO.print(a)
IO.print(a)
}
}
f.call()
// expect: a
// expect: a
@@ -0,0 +1,17 @@
{
var f = null
{
var a = "a"
f = new Fn { IO.print(a) }
}
{
// Since a is out of scope, the local slot will be reused by b. Make sure
// that f still closes over a.
var b = "b"
f.call() // expect: a
}
}
// TODO: Maximum number of closed-over variables (directly and/or indirect).
@@ -0,0 +1,11 @@
{
var foo = "closure"
new Fn {
{
IO.print(foo) // expect: closure
var foo = "shadow"
IO.print(foo) // expect: shadow
}
IO.print(foo) // expect: closure
}.call()
}