mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
More tests for super calls.
This commit is contained in:
20
test/super/call_different_arity.wren
Normal file
20
test/super/call_different_arity.wren
Normal file
@ -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)
|
||||
@ -16,5 +16,4 @@ class Derived is Base {
|
||||
// expect: Base.foo
|
||||
|
||||
// TODO: Super operator calls.
|
||||
// TODO: Super where there is no inherited method.
|
||||
// TODO: Super setter calls.
|
||||
|
||||
7
test/super/no_superclass_method.wren
Normal file
7
test/super/no_superclass_method.wren
Normal file
@ -0,0 +1,7 @@
|
||||
class Base {}
|
||||
|
||||
class Derived is Base {
|
||||
foo { super.doesNotExist } // expect runtime error: Base does not implement method 'doesNotExist'.
|
||||
}
|
||||
|
||||
(new Derived).foo
|
||||
Reference in New Issue
Block a user