Skip to content

Commit eae2dc7

Browse files
committed
Add test for RT #115372
1 parent 1345d8b commit eae2dc7

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

S04-blocks-and-statements/pointy.t

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

33
use Test;
44

5-
plan 17;
5+
plan 18;
66

77
=begin description
88
@@ -30,7 +30,7 @@ is $got, 'x 123', 'called pointy immediately: -> $x { ... }(...)';
3030

3131
# L<S04/Statement-ending blocks/End-of-statement cannot occur within a bracketed expression>
3232
my @a;
33-
lives_ok { @a = ("one", -> $x { $x**2 }, "three")} ,
33+
lives_ok { @a = ("one", -> $x { $x**2 }, "three")} ,
3434
'pointy sub without preceding comma';
3535
is @a[0], 'one', 'pointy sub in list previous argument';
3636
isa_ok @a[1], Code, 'pointy sub in list';
@@ -39,7 +39,7 @@ is @a[2], 'three', 'pointy sub in list following argument';
3939

4040
# L<S06/""Pointy blocks""/behaves like a block with respect to control exceptions>
4141
my $n = 1;
42-
my $s = -> {
42+
my $s = -> {
4343
last if $n == 10;
4444
$n++;
4545
redo if $n < 10;
@@ -52,16 +52,16 @@ is $n, 10, "pointy control exceptions ran";
5252
# L<S06/""Pointy blocks""/will return from the innermost enclosing sub or method>
5353
my $str = '';
5454

55-
sub outer {
56-
my $s = -> {
55+
sub outer {
56+
my $s = -> {
5757
#?rakudo todo '&?ROUTINE'
5858
#?niecza todo 'Unable to resolve method name in class Sub'
59-
is(&?ROUTINE.name, '&Main::outer', 'pointy still sees outer\'s &?ROUTINE');
59+
is(&?ROUTINE.name, '&Main::outer', 'pointy still sees outer\'s &?ROUTINE');
6060

61-
$str ~= 'inner';
62-
return 'inner ret';
61+
$str ~= 'inner';
62+
return 'inner ret';
6363
};
64-
$s.();
64+
$s.();
6565
$str ~= 'outer';
6666
return 'outer ret';
6767
}
@@ -81,11 +81,10 @@ is $str, 'inner', 'return in pointy returns from enclosing sub';
8181
eval_dies_ok(q{{ -> { $^a, $^b } }}, '-> { $^a, $^b } is illegal');
8282

8383
# RT #61034
84-
85-
lives_ok {my $x = -> {}; my $y = $x(); },
84+
lives_ok {my $x = -> {}; my $y = $x(); },
8685
'can define and execute empty pointy block';
8786

88-
# The default type of pointy blocks is Mu, not Any. See
87+
# The default type of pointy blocks is Mu, not Any. See
8988
# http://www.nntp.perl.org/group/perl.perl6.language/2009/03/msg31181.html
9089
# L<S02/Undefined types/default block parameter type>
9190
# this means that junctions don't autothread over pointy blocks
@@ -102,9 +101,15 @@ lives_ok {my $x = -> {}; my $y = $x(); },
102101
ok $ok, 'Blocks receive junctions without autothreading';
103102
is $iterations, 1, 'no autothreading happened';
104103
my $b = -> $x { ... };
105-
ok $b.signature.perl !~~ /Any/,
104+
ok $b.signature.perl !~~ /Any/,
106105
'The .signature of a block does not contain Any';
107106
}
108107

109-
# vim: ft=perl6
108+
# RT #115372
109+
#?rakudo.moar todo 'RT #115372'
110+
{
111+
throws_like q[say -> {YOU_ARE_HERE}], X::Method::NotFound,
112+
'no Segfault when putting YOU_ARE_HERE marker in a pointy block';
113+
}
110114

115+
# vim: ft=perl6

0 commit comments

Comments
 (0)