summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authorsolo989 <solo989@yahoo.com>2020-06-16 13:35:41 -0700
committerAndreas Rumpf <rumpf_a@web.de>2020-06-19 09:53:06 +0200
commit408518c9fed9757fd1cc246e3ced05ecbb3bcaab (patch)
tree6411af58c1b02a0f5732187c8ddefd105a520c6d /tests/macros
parent99ad65fdd616e2bc21a688acffb9f5f310b70066 (diff)
downloadNim-408518c9fed9757fd1cc246e3ced05ecbb3bcaab.tar.gz
Update tuple newLit
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tmacros_various.nim32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/macros/tmacros_various.nim b/tests/macros/tmacros_various.nim
index 3991a5e30..695353b0c 100644
--- a/tests/macros/tmacros_various.nim
+++ b/tests/macros/tmacros_various.nim
@@ -194,3 +194,35 @@ static:
     doAssert(v == a)
 
   echo "macrocache ok"
+  
+block tupleNewLitTests:
+  macro t0(): untyped =
+    result = newLit(())
+  doAssert t0 == ()
+  macro t1(): untyped =
+    result = newLit((5,))
+  doAssert t1 == (5,)
+  macro t2(): untyped =
+    result = newLit((a: 5))
+  doAssert t2 == (a: 5)
+  macro t3(): untyped =
+    result = newLit((5, "5"))
+  doAssert t3 == (5, "5")
+  macro t4(): untyped =
+    result = newLit((a: 5, b: "5"))
+  doAssert t4 == (a: 5, b: "5")
+  macro t5(): untyped =
+    result = newLit(@[(5,)])
+  doAssert t5 == @[(5,)]
+  macro t6(): untyped =
+    result = newLit(@[(a: 5)])
+  doAssert t6 == @[(a: 5)]
+  macro t7(): untyped =
+    result = newLit(@[(5, "5")])
+  doAssert t7 == @[(5, "5")]
+  macro t8(): untyped =
+    result = newLit(@[(a: 5, b: "5")])
+  doAssert t8 == @[(a: 5, b: "5")]
+  macro t9(): untyped =
+    result = newLit(@[(a: (5, 6), b: ())])
+  doAssert t9 == @[(a: (5, 6), b: ())]