summary refs log tree commit diff stats
path: root/tests/arc/trepr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/trepr.nim')
-rw-r--r--tests/arc/trepr.nim63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/arc/trepr.nim b/tests/arc/trepr.nim
index 7a92112ed..abf28330a 100644
--- a/tests/arc/trepr.nim
+++ b/tests/arc/trepr.nim
@@ -4,7 +4,17 @@ discard """
 Table[system.string, trepr.MyType](data: @[], counter: 0)
 nil
 '''
+  output: '''
+nil
+2
+Obj(member: ref @["hello"])
+ref (member: ref @["hello"])
+ObjUa(v: 0, a: [...])
+'''
 """
+
+# xxx consider merging with `tests/stdlib/trepr.nim` to increase overall test coverage
+
 import tables
 
 type
@@ -32,3 +42,56 @@ macro dumpSym(a: typed) =
 
 dumpSym(doAssert)
 
+# bug 13731
+
+import os
+var a: File
+echo repr a
+
+# bug 13872
+
+echo repr(2'u16)
+
+# bug 14270
+
+type
+  Obj = ref object
+    member: ref seq[string]
+
+var c = Obj(member: new seq[string])
+c.member[] = @["hello"]
+echo c.repr
+
+var c2 = new tuple[member: ref seq[string]]
+c2.member = new seq[string]
+c2.member[] = @["hello"]
+echo c2.repr
+
+proc p2 =
+  echo "hey"
+
+discard repr p2
+
+
+#####################################################################
+# bug #15043
+
+import macros
+
+macro extract(): untyped =
+  result = newStmtList()
+  var x: seq[tuple[node: NimNode]]
+
+  proc test(n: NimNode) {.closure.} =
+    x.add (node: n)
+  
+  test(parseExpr("discard"))
+  
+extract()
+
+type
+  ObjUa = ref object
+    v: int
+    a: UncheckedArray[char]
+
+echo ObjUa().repr