summary refs log tree commit diff stats
path: root/tests/tuples
diff options
context:
space:
mode:
authoree7 <45465154+ee7@users.noreply.github.com>2018-12-27 22:40:40 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-12-27 22:40:40 +0100
commitcc4720fac18ba0d9bacdb386cacb409632a5e1a6 (patch)
tree9c317d4e0bf1c866d5de475dd3826fc29a3b2e0e /tests/tuples
parent1b7c8482fef98a9e1c0e4a61e7e928a3e4890192 (diff)
downloadNim-cc4720fac18ba0d9bacdb386cacb409632a5e1a6.tar.gz
Const tuple unpacking: add tests (#10100)
Diffstat (limited to 'tests/tuples')
-rw-r--r--tests/tuples/ttuples_various.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/tuples/ttuples_various.nim b/tests/tuples/ttuples_various.nim
index 010893ced..94a2f3ff0 100644
--- a/tests/tuples/ttuples_various.nim
+++ b/tests/tuples/ttuples_various.nim
@@ -66,6 +66,22 @@ block unpack_asgn:
 
 
 
+block unpack_const:
+  const (a, ) = (1, )
+  doAssert a == 1
+
+  const (b, c) = (2, 3)
+  doAssert b == 2
+  doAssert c == 3
+
+  # bug #10098
+  const (x, y, z) = (4, 5, 6)
+  doAssert x == 4
+  doAssert y == 5
+  doAssert z == 6
+
+
+
 block tuple_subscript:
   proc`[]` (t: tuple, key: string): string =
     for name, field in fieldPairs(t):