Skip to content

Commit 1059587

Browse files
committed
update for anonyvars
1 parent 927f3e1 commit 1059587

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

S03-operators/context.t

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 36;
5+
plan 39;
66

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

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

92-
lives_ok { EVAL '$' }, 'Anonymous $ variable outside of declaration';
93-
lives_ok { EVAL '@' }, 'Anonymous @ variable outside of declaration';
94-
lives_ok { EVAL '%' }, 'Anonymous % variable outside of declaration';
95-
lives_ok { EVAL '&' }, 'Anonymous & variable outside of declaration';
92+
is(($).WHAT.gist, '(Any)', 'Anonymous $ variable can be declared');
93+
is((@).WHAT.gist, '(Array)', 'Anonymous @ variable can be declared');
94+
is((%).WHAT.gist, '(Hash)', 'Anonymous % variable can be declared');
95+
is((&).WHAT.gist, '(Callable)', 'Anonymous & variable can be declared');
96+
97+
is((++$), 1, 'Anonymous $ variable can be incremented');
98+
is((@).push(42,43), '42 43', 'Anonymous @ variable can be pushed');
99+
100+
{
101+
my @seq = map { $_ ~ ++$ }, <a b c>;
102+
is @seq, <a1 b2 c3>, 'Anonymous $ is really a state variable';
103+
}
96104

97105
# RT #76320
98106
{

0 commit comments

Comments
 (0)