Skip to content

Commit 7192d95

Browse files
committed
Add test for RT #114696, fix and unfudge 2 related tests
1 parent 82b0065 commit 7192d95

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

S04-declarations/implicit-parameter.t

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use v6;
22
use Test;
3-
plan 18;
3+
plan 19;
44

5-
# L<S04/The Relationship of Blocks and Declarations/A bare closure
6-
# (except the block associated with a conditional statement)>
5+
# L<S04/The Relationship of Blocks and Declarations/A bare closure
6+
# (except the block associated with a conditional statement)>
77

88
{
99
# test with explicit $_
@@ -19,7 +19,7 @@ plan 18;
1919

2020
{
2121
# { } has implicit signature ($_ is rw = $OUTER::_)
22-
22+
2323
$_ = 'Hello';
2424
is(try { { $_ }.() }, 'Hello', '$_ in bare block defaults to outer');
2525
is({ $_ }.('Goodbye'), 'Goodbye', 'but it is only a default');
@@ -33,15 +33,14 @@ plan 18;
3333
}
3434

3535
{
36-
$_ = 'Ack';
36+
$_ = 'Ack!';
3737
dies_ok({ (-> { "Boo!" }).(42) }, '-> {} is arity 0');
3838
dies_ok({ (-> { $_ }).(42) }, 'Even when we use $_>');
39-
40-
#?rakudo 2 todo 'pointy blocks and $_'
39+
4140
#?niecza todo
4241
is((-> { $_ }).(), 'Ack!', '$_ is lexical here');
4342
#?niecza todo
44-
is(-> $a { $_ }.(42), 'Ack!', 'Even with parameters (?)');
43+
is(-> $a { $_ }.(42), 'Ack!', 'Even with parameters');
4544
is(-> $_ { $_ }.(42), 42, 'But not when the parameter is $_');
4645

4746
eval_dies_ok( 'sub () { -> { $^a }.() }', 'Placeholders not allowed in ->');
@@ -53,4 +52,15 @@ plan 18;
5352
eval_dies_ok('sub () { $^foo }.(42)', 'Placeholders not allowed in sub()');
5453
}
5554

55+
# RT #114696
56+
{
57+
my $string;
58+
$_ = 'Moo';
59+
for .chars ... 1 -> $len {
60+
$string ~= $_;
61+
{ $string ~= $_; }
62+
}
63+
is $string, 'MooMooMooMooMooMoo', 'outer $_ is seen within nested blocks';
64+
}
65+
5666
# vim: ft=perl6

0 commit comments

Comments
 (0)