Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 19 lines (15 sloc) 0.396 kB
de174b3 [spec] test for $_ being treated as formal parameter of a block
moritz authored
1 use v6;
2 use Test;
3 plan 2;
4
5 # L<S04/The Relationship of Blocks and Declarations/"A bare closure without
6 # placeholder arguments that uses $_">
7
8 {
9 # test with explicit $_
10 my $f1 = { 2*$_ };
11 is $f1(2), 4, 'Block with explit $_ has one formal paramter';
12 }
13
14 {
15 # test with implicit $_
16 my $f2 = { .sqrt };
17 is_approx $f2(4), 2, 'Block with implict $_ has one formal parameter';
18 }
Something went wrong with that request. Please try again.