Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests for RT #126626.
  • Loading branch information
jnthn committed Dec 16, 2015
1 parent 780f5bf commit a1c2454
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions S04-declarations/my.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 99;
plan 105;

#L<S04/The Relationship of Blocks and Declarations/"declarations, all
# lexically scoped declarations are visible">
Expand Down Expand Up @@ -340,13 +340,23 @@ eval-lives-ok 'multi f(@a) { }; multi f(*@a) { }; f(my @a = (1, 2, 3))',
}

# RT #117043
# RT #126626
{
my (\x1) = 1;
is \x1, 1,
is x1, 1,
'can declare sigilless within parenthesis';
dies-ok { x1 = 2 }, 'cannot assign to sigilless variable after declaration (one)';
my ($x2, \x3) = (2, 3);
is ($x2, \x3).join(" "), '2 3',
is ($x2, x3).join(" "), '2 3',
'declarator with multiple variables can contain sigilless';
dies-ok { x3 = 4 }, 'cannot assign to sigilless variable after declaration (many)';

throws-like 'my (\a)', X::Syntax::Term::MissingInitializer;
throws-like 'my (\a, \b)', X::Syntax::Term::MissingInitializer;

my (\x5, \x6) := 7, 8;
is x5, 7, 'can signature-bind to my (\a, \b) and get correct values (1)';
is x6, 8, 'can signature-bind to my (\a, \b) and get correct values (2)';
}

{
Expand Down

0 comments on commit a1c2454

Please sign in to comment.