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,16 @@
|
||||
class Foo {
|
||||
static initialize { __field = "Foo field" }
|
||||
|
||||
static closeOverGet {
|
||||
return new Fn { __field }
|
||||
}
|
||||
|
||||
static closeOverSet {
|
||||
return new Fn { __field = "new value" }
|
||||
}
|
||||
}
|
||||
|
||||
Foo.initialize
|
||||
IO.print(Foo.closeOverGet.call()) // expect: Foo field
|
||||
Foo.closeOverSet.call()
|
||||
IO.print(Foo.closeOverGet.call()) // expect: new value
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
static write { IO.print(__field) }
|
||||
}
|
||||
|
||||
Foo.write // expect: null
|
||||
@@ -0,0 +1,25 @@
|
||||
class Foo {
|
||||
set(a, b, c, d, e) {
|
||||
__a = a
|
||||
__b = b
|
||||
__c = c
|
||||
__d = d
|
||||
__e = e
|
||||
}
|
||||
|
||||
write {
|
||||
IO.print(__a)
|
||||
IO.print(__b)
|
||||
IO.print(__c)
|
||||
IO.print(__d)
|
||||
IO.print(__e)
|
||||
}
|
||||
}
|
||||
|
||||
(new Foo).set(1, 2, 3, 4, 5)
|
||||
(new Foo).write
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
// expect: 4
|
||||
// expect: 5
|
||||
@@ -0,0 +1,25 @@
|
||||
class Foo {
|
||||
static set(a, b, c, d, e) {
|
||||
__a = a
|
||||
__b = b
|
||||
__c = c
|
||||
__d = d
|
||||
__e = e
|
||||
}
|
||||
|
||||
static write {
|
||||
IO.print(__a)
|
||||
IO.print(__b)
|
||||
IO.print(__c)
|
||||
IO.print(__d)
|
||||
IO.print(__e)
|
||||
}
|
||||
}
|
||||
|
||||
Foo.set(1, 2, 3, 4, 5)
|
||||
Foo.write
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
// expect: 4
|
||||
// expect: 5
|
||||
@@ -0,0 +1,34 @@
|
||||
class Outer {
|
||||
static staticMethod {
|
||||
__field = "outer"
|
||||
IO.print(__field) // expect: outer
|
||||
|
||||
class Inner {
|
||||
static staticMethod {
|
||||
__field = "inner"
|
||||
IO.print(__field) // expect: inner
|
||||
}
|
||||
}
|
||||
|
||||
Inner.staticMethod
|
||||
IO.print(__field) // expect: outer
|
||||
}
|
||||
|
||||
instanceMethod {
|
||||
__field = "outer"
|
||||
IO.print(__field) // expect: outer
|
||||
|
||||
class Inner {
|
||||
instanceMethod {
|
||||
__field = "inner"
|
||||
IO.print(__field) // expect: inner
|
||||
}
|
||||
}
|
||||
|
||||
(new Inner).instanceMethod
|
||||
IO.print(__field) // expect: outer
|
||||
}
|
||||
}
|
||||
|
||||
Outer.staticMethod
|
||||
(new Outer).instanceMethod
|
||||
@@ -0,0 +1 @@
|
||||
__field = "wat" // expect error
|
||||
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
static write { IO.print(__field) } // Compile a use of the field...
|
||||
static init { __field = "value" } // ...before an assignment to it.
|
||||
}
|
||||
|
||||
// But invoke them in the right order.
|
||||
Foo.init
|
||||
Foo.write // expect: value
|
||||
Reference in New Issue
Block a user