|
2 | 2 |
|
3 | 3 | use Test;
|
4 | 4 |
|
5 |
| -plan 36; |
| 5 | +plan 39; |
6 | 6 |
|
7 | 7 | # L<S03/List prefix precedence/The list contextualizer>
|
8 | 8 |
|
@@ -89,10 +89,18 @@ plan 36;
|
89 | 89 | eval_dies_ok('%{$hash}', 'Perl 5 form of %{$hash} dies');
|
90 | 90 | }
|
91 | 91 |
|
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 | +} |
96 | 104 |
|
97 | 105 | # RT #76320
|
98 | 106 | {
|
|
0 commit comments