new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
|
|
@ -1,36 +0,0 @@
|
|||
discard """
|
||||
file: "tmultim2.nim"
|
||||
output: "collide: unit, thing collide: unit, thing collide: thing, unit"
|
||||
"""
|
||||
# Test multi methods
|
||||
|
||||
type
|
||||
TThing = object {.inheritable.}
|
||||
TUnit = object of TThing
|
||||
x: int
|
||||
TParticle = object of TThing
|
||||
a, b: int
|
||||
|
||||
method collide(a, b: TThing) {.inline.} =
|
||||
quit "to override!"
|
||||
|
||||
method collide(a: TThing, b: TUnit) {.inline.} =
|
||||
write stdout, "collide: thing, unit "
|
||||
|
||||
method collide(a: TUnit, b: TThing) {.inline.} =
|
||||
write stdout, "collide: unit, thing "
|
||||
|
||||
proc test(a, b: TThing) {.inline.} =
|
||||
collide(a, b)
|
||||
|
||||
var
|
||||
a: TThing
|
||||
b, c: TUnit
|
||||
collide(b, c) # ambiguous (unit, thing) or (thing, unit)? -> prefer unit, thing!
|
||||
test(b, c)
|
||||
collide(a, b)
|
||||
#OUT collide: unit, thing collide: unit, thing collide: thing, unit
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue