diff options
author | Jasper Jenkins <jasper.vs.jenkins@gmail.com> | 2019-05-01 22:18:45 -0700 |
---|---|---|
committer | Jasper Jenkins <jasper.vs.jenkins@gmail.com> | 2019-05-01 22:18:45 -0700 |
commit | 8a6b416c28d635365b2718021e0c4b34e9ec8a00 (patch) | |
tree | 960dba06ca8940b43e80b87c49cb38cf11d6af65 /tests | |
parent | c94ab46923852d2eb96eab5e518d392b0d705fce (diff) | |
download | Nim-8a6b416c28d635365b2718021e0c4b34e9ec8a00.tar.gz |
const named tuple unpacking
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tuples/ttuples_various.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tuples/ttuples_various.nim b/tests/tuples/ttuples_various.nim index 94a2f3ff0..dc060da1e 100644 --- a/tests/tuples/ttuples_various.nim +++ b/tests/tuples/ttuples_various.nim @@ -81,6 +81,27 @@ block unpack_const: doAssert z == 6 +# bug #10724 +block unpack_const_named: + const (a, ) = (x: 1, ) + doAssert a == 1 + + const (b, c) = (x: 2, y: 3) + doAssert b == 2 + doAssert c == 3 + + const (d, e, f) = (x: 4, y: 5, z: 6) + doAssert d == 4 + doAssert e == 5 + doAssert f == 6 + +block const_named: + const x = block: + (a: 1, b: 2, c: 3) + doAssert x.a == 1 + doAssert x.b == 2 + doAssert x.c == 3 + block tuple_subscript: proc`[]` (t: tuple, key: string): string = |