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