diff options
author | Araq <rumpf_a@web.de> | 2013-09-10 22:04:12 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-09-10 22:04:12 +0200 |
commit | 275c7ccf82e03622258c135890c0419e70ee0884 (patch) | |
tree | 986a3e9a990c26dc9b0ad6fedbbdfd1ac49f3d9d /tests/run/tobjasgn.nim | |
parent | 138db5a85d1cb613d126241139471e849150ca05 (diff) | |
download | Nim-275c7ccf82e03622258c135890c0419e70ee0884.tar.gz |
fixes #575
Diffstat (limited to 'tests/run/tobjasgn.nim')
-rw-r--r-- | tests/run/tobjasgn.nim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/run/tobjasgn.nim b/tests/run/tobjasgn.nim new file mode 100644 index 000000000..5f411063f --- /dev/null +++ b/tests/run/tobjasgn.nim @@ -0,0 +1,39 @@ +discard """ + output: '''0 +pre test a:test b:1 c:2 haha:3 +assignment test a:test b:1 c:2 haha:3 +''' +""" + +type TSomeObj = object of TObject + Variable: int + +var a = TSomeObj() + +echo a.Variable.`$` + +# bug #575 + +type + Something = object of Tobject + a: string + b, c: int32 + +type + Other = object of Something + haha: int + +proc `$`(x: Other): string = + result = "a:" & x.a & " b:" & $x.b & " c:" & $x.c & " haha:" & $x.haha + +var + t: Other + +t.a = "test" +t.b = 1 +t.c = 2 +t.haha = 3 + +echo "pre test ", $t +var x = t +echo "assignment test ", x |