Skip to content

Commit

Permalink
update for anonyvars
Browse files Browse the repository at this point in the history
  • Loading branch information
TimToady committed Aug 29, 2014
1 parent 927f3e1 commit 1059587
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions S03-operators/context.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 36;
plan 39;

# L<S03/List prefix precedence/The list contextualizer>

Expand Down Expand Up @@ -89,10 +89,18 @@ plan 36;
eval_dies_ok('%{$hash}', 'Perl 5 form of %{$hash} dies');
}

lives_ok { EVAL '$' }, 'Anonymous $ variable outside of declaration';
lives_ok { EVAL '@' }, 'Anonymous @ variable outside of declaration';
lives_ok { EVAL '%' }, 'Anonymous % variable outside of declaration';
lives_ok { EVAL '&' }, 'Anonymous & variable outside of declaration';
is(($).WHAT.gist, '(Any)', 'Anonymous $ variable can be declared');
is((@).WHAT.gist, '(Array)', 'Anonymous @ variable can be declared');
is((%).WHAT.gist, '(Hash)', 'Anonymous % variable can be declared');
is((&).WHAT.gist, '(Callable)', 'Anonymous & variable can be declared');

is((++$), 1, 'Anonymous $ variable can be incremented');
is((@).push(42,43), '42 43', 'Anonymous @ variable can be pushed');

{
my @seq = map { $_ ~ ++$ }, <a b c>;
is @seq, <a1 b2 c3>, 'Anonymous $ is really a state variable';
}

# RT #76320
{
Expand Down

0 comments on commit 1059587

Please sign in to comment.