summary refs log tree commit diff stats
path: root/tests/vm
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-01-08 18:37:25 -0800
committerGitHub <noreply@github.com>2019-01-08 18:37:25 -0800
commit6ce3949c8aa489d268f272829d03edab175bfc7a (patch)
tree777513c9aef3896204b8dfd9cea40517d57d2ce7 /tests/vm
parentbf3a308e86e7c5999855546962aed564218a8121 (diff)
downloadNim-6ce3949c8aa489d268f272829d03edab175bfc7a.tar.gz
add `isNamedTuple`; make $(1, 2) be (1, 2) instead of (Field0: 1, Field1: 2) which leaked implementation detail (#10070)
* add `isNamedTuple`; make $(1, 2) be (1, 2) instead of leaking implementation detail (Field0: 1, Field1: 2)
  fixes this: #8670 (comment) /cc @alehander42 @Vindaar @mratsim

* Note: isNamedTuple is useful in other places, eg #10010 (comment)

* move isNamedTuple to helpers.nim to avoid exposing new symbol to system.nim

* remove workaround in tests/vm/tissues.nim failing test now that #10218 was makes it work
Diffstat (limited to 'tests/vm')
-rw-r--r--tests/vm/tissues.nim14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/vm/tissues.nim b/tests/vm/tissues.nim
index 021b902ad..063559d2e 100644
--- a/tests/vm/tissues.nim
+++ b/tests/vm/tissues.nim
@@ -1,16 +1,14 @@
-discard """
-  nimout: "(Field0: 2, Field1: 2, Field2: 2, Field3: 2)"
-"""
-
 import macros
 
-block t9043:
-  proc foo[N: static[int]](dims: array[N, int])=
+block t9043: # issue #9043
+  proc foo[N: static[int]](dims: array[N, int]): string =
     const N1 = N
     const N2 = dims.len
-    static: echo (N, dims.len, N1, N2)
+    const ret = $(N, dims.len, N1, N2)
+    static: doAssert ret == $(N, dims.len, N1, N2)
+    ret
 
-  foo([1, 2])
+  doAssert foo([1, 2]) == "(2, 2, 2, 2)"
 
 block t4952:
   proc doCheck(tree: NimNode) =