Skip to content

Commit

Permalink
[spec] test for $_ being treated as formal parameter of a block
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@21067 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Jun 26, 2008
1 parent cc1d39f commit de174b3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions S04-declarations/implicit-parameter.t
@@ -0,0 +1,18 @@
use v6;
use Test;
plan 2;

# L<S04/The Relationship of Blocks and Declarations/"A bare closure without
# placeholder arguments that uses $_">

{
# test with explicit $_
my $f1 = { 2*$_ };
is $f1(2), 4, 'Block with explit $_ has one formal paramter';
}

{
# test with implicit $_
my $f2 = { .sqrt };
is_approx $f2(4), 2, 'Block with implict $_ has one formal parameter';
}

0 comments on commit de174b3

Please sign in to comment.