Skip to content

Commit

Permalink
Test unpacking Callable signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Dec 12, 2017
1 parent 5cd8dff commit a31e465
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions S06-signature/closure-parameters.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 18;
plan 22;

# L<S06/Closure parameters>

Expand Down Expand Up @@ -64,7 +64,7 @@ plan 18;
is t1(&takes-str-returns-bool), 'Str --> Bool',
'Multi dispatch based on closure parameter syntax (4)';

dies-ok { t1( -> { 3 }) },
dies-ok { t1( -> { 3 }) },
'Multi dispatch based on closure parameter syntax (5)';
}

Expand All @@ -79,4 +79,23 @@ plan 18;
throws-like 'sub f (Int &b:(--> Bool)) { }', X::Redeclaration, 'only one way of specifying sub-signature return type allowed';
}

# RT #123116
{
lives-ok {
my class Dog {};
sub foo(&block (Dog --> Bool)) {
pass 'called sub in unpacking Callable signature with whitespace';
}
foo(sub (Dog $x --> Bool) { $x })
}, 'unpacking Callable signature with whitespace';

lives-ok {
my class Dog {};
sub foo(&block:(Dog --> Bool)) {
pass 'called sub in unpacking Callable signature with colon';
}
foo(sub (Dog $x --> Bool) { $x })
}, 'unpacking Callable signature with colon';
}

# vim: ft=perl6

0 comments on commit a31e465

Please sign in to comment.