diff options
Diffstat (limited to 'tests/lookups/tkoeniglookup.nim')
-rw-r--r-- | tests/lookups/tkoeniglookup.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lookups/tkoeniglookup.nim b/tests/lookups/tkoeniglookup.nim new file mode 100644 index 000000000..8b140cceb --- /dev/null +++ b/tests/lookups/tkoeniglookup.nim @@ -0,0 +1,17 @@ +discard """ + output: '''x: 0 y: 0''' +""" + +proc toString*[T](x: T): string = return $x + + +type + TMyObj = object + x, y: int + +proc `$`*(a: TMyObj): string = + result = "x: " & $a.x & " y: " & $a.y + +var a: TMyObj +echo toString(a) + |