summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-06-18 13:36:45 -0700
committerAndreas Rumpf <rumpf_a@web.de>2020-06-19 09:53:06 +0200
commit9c42ae91b735bda29de9afbc1333da52a85b3297 (patch)
treeb482018131516e2d7cf8db841c537c7f63c51e03 /tests
parent408518c9fed9757fd1cc246e3ced05ecbb3bcaab (diff)
downloadNim-9c42ae91b735bda29de9afbc1333da52a85b3297.tar.gz
add legacy workaround; improve test so that it actually tests for the bugfix
Diffstat (limited to 'tests')
-rw-r--r--tests/macros/tmacros_various.nim38
1 files changed, 7 insertions, 31 deletions
diff --git a/tests/macros/tmacros_various.nim b/tests/macros/tmacros_various.nim
index 695353b0c..533db25e1 100644
--- a/tests/macros/tmacros_various.nim
+++ b/tests/macros/tmacros_various.nim
@@ -194,35 +194,11 @@ 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: ())]
+  macro t(): untyped =
+    result = newLit (1, "foo", (), (1,), (a1: 'x', a2: @["ba"]))
+  doAssert $t() == """(1, "foo", (), (1,), (a1: 'x', a2: @["ba"]))"""
+    # this `$` test is needed because tuple equality doesn't distinguish
+    # between named vs unnamed tuples
+  doAssert t() == (1, "foo", (), (1, ), (a1: 'x', a2: @["ba"]))