Skip to content

Commit

Permalink
Test for RT #123897.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 30, 2015
1 parent 6ad32a7 commit 73cd22a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion S06-signature/optional.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S06/Optional parameters/>

plan 30;
plan 31;

sub opt1($p?) { defined($p) ?? $p !! 'undef'; }

Expand Down Expand Up @@ -127,11 +127,15 @@ eval-dies-ok 'sub opt($a = 1, $b) { }',
}

# RT #112922
# RT #123897
{
throws-like 'sub foo(Int $x = "omg") { }', X::Parameter::Default::TypeCheck,
'Catch impossible default types at compile time';
throws-like 'sub foo(Bool $b = sub { False }) {}', X::Parameter::Default::TypeCheck,
'Catch impossible default types at compile time (code object)';
throws-like 'my class BSON::Javascript { }; multi c1 (BSON::Javascript :$js2 = "") { }',
X::Parameter::Default::TypeCheck,
'Catch impossible default types at compile time (multi)';
}

# vim: ft=perl6

0 comments on commit 73cd22a

Please sign in to comment.