Skip to content

Commit

Permalink
Test binding/assignment to grouped sigilless vars
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Dec 12, 2017
1 parent 9fbde14 commit 69d9d04
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion S04-declarations/my.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 107;
plan 110;

#L<S04/The Relationship of Blocks and Declarations/"declarations, all
# lexically scoped declarations are visible">
Expand Down Expand Up @@ -398,4 +398,37 @@ subtest 'dies on conflicting type constraints' => {
'Type + of Type + is default';
}

# RT #124210
subtest 'can assign to sigil-less variables' => {
plan 3;
my \a = 1; is-deeply a, 1, 'simple';
my (\b, \c) = 1, 2; is-deeply (b, c), (1, 2), 'complex';
my (\d, (\e, (\f, (\g, \h)))) = 1, (2, (3, (4, 5)));
#?rakudo skip 'RT131071'
is-deeply (d, e, f, g, h), (1, 2, 3, 4, 5), 'complexerastic';
}

# RT #124210
subtest 'can bind to sigil-less variables' => {
plan 3;
my \a := 1; is-deeply a, 1, 'simple';
my (\b, \c) := 1, 2; is-deeply (b, c), (1, 2), 'complex';
my (\d, (\e, (\f, (\g, \h)))) := 1, (2, (3, (4, 5)));
#?rakudo skip 'RT131071'
is-deeply (d, e, f, g, h), (1, 2, 3, 4, 5), 'complexerastic';
}

# RT #124210
subtest 'can compile-time bind to sigil-less variables' => {
plan 3;
#?rakudo 3 skip '::= NYI'
ok 1;
ok 1;
ok 1;
# my \a ::= 1; is-deeply a, 1, 'simple';
# my (\b, \c) ::= 1, 2; is-deeply (b, c), (1, 2), 'complex';
# my (\d, (\e, (\f, (\g, \h)))) ::= 1, (2, (3, (4, 5)));
# is-deeply (d, e, f, g, h), (1, 2, 3, 4, 5), 'complexerastic';
}

# vim: ft=perl6

0 comments on commit 69d9d04

Please sign in to comment.