Const tuple unpacking: add tests (#10100)
This commit is contained in:
parent
1b7c8482fe
commit
cc4720fac1
1 changed files with 16 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue