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:
Bob Nystrom
2015-03-14 12:45:56 -07:00
parent e2a72282a1
commit 64eccdd9be
562 changed files with 32 additions and 8 deletions
@@ -0,0 +1,11 @@
import "module" for Module, Other
IO.print(Module) // expect: before
// Reassigning the variable in the other module does not affect this one's
// binding.
Other.change
IO.print(Module) // expect: before
// But it does change there.
Other.show // expect: after
@@ -0,0 +1,12 @@
// nontest
var Module = "before"
class Other {
static change {
Module = "after"
}
static show {
IO.print(Module)
}
}
@@ -0,0 +1,9 @@
// nontest
IO.print("start a")
var A = "a value"
IO.print("a defined ", A)
import "b" for B
IO.print("a imported ", B)
IO.print("end a")
@@ -0,0 +1,9 @@
// nontest
IO.print("start b")
var B = "b value"
IO.print("b defined ", B)
import "a" for A
IO.print("b imported ", A)
IO.print("end b")
@@ -0,0 +1,11 @@
import "a"
// Shared module should only run once:
// expect: start a
// expect: a defined a value
// expect: start b
// expect: b defined b value
// expect: b imported a value
// expect: end b
// expect: a imported b value
// expect: end a
@@ -0,0 +1,15 @@
import "module"
// expect: Bool
// expect: Class
// expect: Fiber
// expect: Fn
// expect: List
// expect: Map
// expect: MapKeySequence
// expect: MapValueSequence
// expect: Null
// expect: Num
// expect: Object
// expect: Range
// expect: Sequence
// expect: String
@@ -0,0 +1,15 @@
// nontest
IO.print(Bool)
IO.print(Class)
IO.print(Fiber)
IO.print(Fn)
IO.print(List)
IO.print(Map)
IO.print(MapKeySequence)
IO.print(MapValueSequence)
IO.print(Null)
IO.print(Num)
IO.print(Object)
IO.print(Range)
IO.print(Sequence)
IO.print(String)
@@ -0,0 +1,10 @@
var Module = "outer"
if (true) {
import "module" for Module
// expect: ran module
IO.print(Module) // expect: from module
}
IO.print(Module) // expect: outer
@@ -0,0 +1,3 @@
// nontest
var Module = "from module"
IO.print("ran module")
+1
View File
@@ -0,0 +1 @@
import "module" NoString // expect error
@@ -0,0 +1 @@
import for NoString // expect error
@@ -0,0 +1,8 @@
// nontest
var Module1 = "from module one"
var Module2 = "from module two"
var Module3 = "from module three"
var Module4 = "from module four"
var Module5 = "from module five"
IO.print("ran module")
@@ -0,0 +1,10 @@
import "module" for Module1, Module2, Module3, Module4, Module5
// Only execute module body once:
// expect: ran module
IO.print(Module1) // expect: from module one
IO.print(Module2) // expect: from module two
IO.print(Module3) // expect: from module three
IO.print(Module4) // expect: from module four
IO.print(Module5) // expect: from module five
+2
View File
@@ -0,0 +1,2 @@
var Collides
import "module" for Collides // expect error
@@ -0,0 +1,2 @@
// nontest
IO.print("ran module")
@@ -0,0 +1,2 @@
import "module"
// expect: ran module
@@ -0,0 +1,5 @@
// nontest
IO.print("a")
import "shared" for Shared
var A = "a " + Shared
IO.print("a done")
@@ -0,0 +1,5 @@
// nontest
IO.print("b")
import "shared" for Shared
var B = "b " + Shared
IO.print("b done")
@@ -0,0 +1,3 @@
// nontest
IO.print("shared")
var Shared = "shared"
@@ -0,0 +1,12 @@
import "a" for A
import "b" for B
// Shared module should only run once:
// expect: a
// expect: shared
// expect: a done
// expect: b
// expect: b done
IO.print(A) // expect: a shared
IO.print(B) // expect: b shared
@@ -0,0 +1,3 @@
// nontest
var Module = "from module"
IO.print("ran module")
@@ -0,0 +1,4 @@
import "module" for Module
// expect: ran module
IO.print(Module) // expect: from module
+1
View File
@@ -0,0 +1 @@
import "does_not_exist" for DoesNotExist // expect runtime error: Could not find module 'does_not_exist'.
@@ -0,0 +1,3 @@
// nontest
var Module = "from module"
IO.print("ran module")
@@ -0,0 +1,3 @@
// Should execute the module:
// expect: ran module
import "module" for DoesNotExist // expect runtime error: Could not find a variable named 'DoesNotExist' in module 'module'.