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/converter/tgenericconverter.nim
Normal file
30
tests/converter/tgenericconverter.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
discard """
|
||||
output: '''666
|
||||
666'''
|
||||
"""
|
||||
|
||||
# test the new generic converters:
|
||||
|
||||
type
|
||||
TFoo2[T] = object
|
||||
x: T
|
||||
|
||||
TFoo[T] = object
|
||||
data: array[0..100, T]
|
||||
|
||||
converter toFoo[T](a: TFoo2[T]): TFoo[T] =
|
||||
result.data[0] = a.x
|
||||
|
||||
proc p(a: TFoo[int]) =
|
||||
echo a.data[0]
|
||||
|
||||
proc q[T](a: TFoo[T]) =
|
||||
echo a.data[0]
|
||||
|
||||
|
||||
var
|
||||
aa: TFoo2[int]
|
||||
aa.x = 666
|
||||
|
||||
p aa
|
||||
q aa
|
||||
Loading…
Add table
Add a link
Reference in a new issue