diff options
author | ee7 <45465154+ee7@users.noreply.github.com> | 2018-12-27 22:40:40 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-12-27 22:40:40 +0100 |
commit | cc4720fac18ba0d9bacdb386cacb409632a5e1a6 (patch) | |
tree | 9c317d4e0bf1c866d5de475dd3826fc29a3b2e0e /tests/tuples | |
parent | 1b7c8482fef98a9e1c0e4a61e7e928a3e4890192 (diff) | |
download | Nim-cc4720fac18ba0d9bacdb386cacb409632a5e1a6.tar.gz |
Const tuple unpacking: add tests (#10100)
Diffstat (limited to 'tests/tuples')
-rw-r--r-- | tests/tuples/ttuples_various.nim | 16 |
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): |