IC: added basic test case for methods (#17679)
* IC: added basic test case for methods * IC: better methods test
This commit is contained in:
parent
e4b64eee89
commit
13b958eb45
4 changed files with 64 additions and 8 deletions
28
tests/ic/tmethods.nim
Normal file
28
tests/ic/tmethods.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
discard """
|
||||
output: '''Base abc'''
|
||||
"""
|
||||
|
||||
import mbaseobj
|
||||
|
||||
var c = Base(s: "abc")
|
||||
m c
|
||||
|
||||
#!EDIT!#
|
||||
|
||||
discard """
|
||||
output: '''Base abc
|
||||
Inherited abc'''
|
||||
"""
|
||||
|
||||
import mbaseobj
|
||||
|
||||
type
|
||||
Inherited = ref object of Base
|
||||
|
||||
method m(i: Inherited) =
|
||||
procCall m(Base i)
|
||||
echo "Inherited ", i.s
|
||||
|
||||
var c = Inherited(s: "abc")
|
||||
m c
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue