summary refs log tree commit diff stats
path: root/tests/stdlib/tmarshal.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/tmarshal.nim')
-rw-r--r--tests/stdlib/tmarshal.nim28
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/stdlib/tmarshal.nim b/tests/stdlib/tmarshal.nim
index 5471d347a..a778d2f77 100644
--- a/tests/stdlib/tmarshal.nim
+++ b/tests/stdlib/tmarshal.nim
@@ -1,16 +1,16 @@
 discard """
-  output: ""
+  output: '''{"age": 12, "name": "Cletus"}'''
 """
 
 import marshal
 
-template testit(x: expr) = echo($$to[type(x)]($$x))
+template testit(x: expr) = discard $$to[type(x)]($$x)
 
-var x: array[0..4, array[0..4, string]] = [

-  ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"], 

-  ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"], 

-  ["test", "1", "2", "3", "4"]]

-testit(x)

+var x: array[0..4, array[0..4, string]] = [
+  ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"],
+  ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"],
+  ["test", "1", "2", "3", "4"]]
+testit(x)
 var test2: tuple[name: string, s: int] = ("tuple test", 56)
 testit(test2)
 
@@ -24,7 +24,7 @@ type
     of blah:
       help: string
     else:
-      nil
+      discard
       
   PNode = ref TNode
   TNode = object
@@ -63,3 +63,15 @@ testit(test7)
 var test6: set[char] = {'A'..'Z', '_'}
 testit(test6)
 
+
+# bug #1352
+
+type
+  Entity = object of RootObj
+    name: string
+
+  Person = object of Entity
+    age: int
+
+var instance1 = Person(name: "Cletus", age: 12)
+echo($$instance1)