Skip to content

Commit

Permalink
[t] move code_blocks_as_sub_args.t to spec/
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@25438 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Feb 19, 2009
1 parent 5579397 commit fea49c9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions integration/code-blocks-as-sub-args.t
@@ -0,0 +1,23 @@
use v6;

use Test;

plan 4;

=begin desc
Test a bug where sub args of type Sub do not get handled correctly.
=end desc

sub foo (Sub $code, Str $a, Str $b) { return $a.WHAT }

dies_ok {foo(-> { die "test" }, "a", "b")}, 'pointy block is not a sub';
lives_ok {foo( sub { die "test" }, 'a', 'b')}, 'anonymous sub as argument not executed';

sub foo2 (Sub $code, Str $a, Str $b?) { return $a.WHAT }

dies_ok {foo2(-> { die "test" }, "a", "b")}, 'pointy block is not a sub (with optional last arg)';
lives_ok {foo2( sub { die "test" }, 'a', 'b')}, 'anonymous sub as argument not executed (with optional last arg)';

# vim: ft=perl6

0 comments on commit fea49c9

Please sign in to comment.