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,20 @@
|
||||
class Base {
|
||||
foo { IO.print("Base.foo") }
|
||||
foo(a) { IO.print("Base.foo(a)") }
|
||||
foo(a, b) { IO.print("Base.foo(a, b)") }
|
||||
}
|
||||
|
||||
class Derived is Base {
|
||||
foo(a) {
|
||||
IO.print("Derived.bar(a)")
|
||||
super
|
||||
super(1)
|
||||
super(1, 2)
|
||||
}
|
||||
}
|
||||
|
||||
(new Derived).foo(1)
|
||||
// expect: Derived.bar(a)
|
||||
// expect: Base.foo
|
||||
// expect: Base.foo(a)
|
||||
// expect: Base.foo(a, b)
|
||||
@@ -0,0 +1,19 @@
|
||||
class Base {
|
||||
foo {
|
||||
IO.print("Base.foo")
|
||||
}
|
||||
}
|
||||
|
||||
class Derived is Base {
|
||||
bar {
|
||||
IO.print("Derived.bar")
|
||||
super.foo
|
||||
}
|
||||
}
|
||||
|
||||
(new Derived).bar
|
||||
// expect: Derived.bar
|
||||
// expect: Base.foo
|
||||
|
||||
// TODO: Super operator calls.
|
||||
// TODO: Super setter calls.
|
||||
@@ -0,0 +1,16 @@
|
||||
class Base {
|
||||
foo {
|
||||
IO.print("Base.foo")
|
||||
}
|
||||
}
|
||||
|
||||
class Derived is Base {
|
||||
foo {
|
||||
IO.print("Derived.foo")
|
||||
super.foo
|
||||
}
|
||||
}
|
||||
|
||||
(new Derived).foo
|
||||
// expect: Derived.foo
|
||||
// expect: Base.foo
|
||||
@@ -0,0 +1,11 @@
|
||||
class Base {
|
||||
toString { "Base" }
|
||||
}
|
||||
|
||||
class Derived is Base {
|
||||
getClosure { new Fn { super.toString } }
|
||||
toString { "Derived" }
|
||||
}
|
||||
|
||||
var closure = (new Derived).getClosure
|
||||
IO.print(closure.call()) // expect: Base
|
||||
@@ -0,0 +1,16 @@
|
||||
class Base {
|
||||
foo {
|
||||
IO.print("Base.foo")
|
||||
}
|
||||
}
|
||||
|
||||
class Derived is Base {
|
||||
foo {
|
||||
IO.print("Derived.foo")
|
||||
super
|
||||
}
|
||||
}
|
||||
|
||||
(new Derived).foo
|
||||
// expect: Derived.foo
|
||||
// expect: Base.foo
|
||||
@@ -0,0 +1,18 @@
|
||||
class A {
|
||||
foo {
|
||||
IO.print("A.foo")
|
||||
}
|
||||
}
|
||||
|
||||
class B is A {}
|
||||
|
||||
class C is B {
|
||||
foo {
|
||||
IO.print("C.foo")
|
||||
super.foo
|
||||
}
|
||||
}
|
||||
|
||||
(new C).foo
|
||||
// expect: C.foo
|
||||
// expect: A.foo
|
||||
@@ -0,0 +1,7 @@
|
||||
class Base {}
|
||||
|
||||
class Derived is Base {
|
||||
foo { super.doesNotExist(1) } // expect runtime error: Base does not implement 'doesNotExist(_)'.
|
||||
}
|
||||
|
||||
(new Derived).foo
|
||||
@@ -0,0 +1,4 @@
|
||||
super.foo // expect error
|
||||
super // expect error
|
||||
super.foo("bar") // expect error
|
||||
super("foo") // expect error
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
static method {
|
||||
super // expect error
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
new Fn {
|
||||
super.foo // expect error
|
||||
}
|
||||
Reference in New Issue
Block a user