Skip to content

Commit

Permalink
Add tests for RT #79288
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Jan 4, 2015
1 parent a543b07 commit 1014935
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion S06-signature/optional.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S06/Optional parameters/>

plan 26;
plan 28;

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

Expand Down Expand Up @@ -113,4 +113,16 @@ eval_dies_ok 'sub opt($a = 1, $b) { }',
'question mark for optional parameter is parsed correctly';
}

# RT #79288
## TODO: implement typed exception and check for that one instead of Exception
{
throws_like { EVAL q[ sub foo($x? is rw) {} ] }, Exception,
message => "Cannot use 'is rw' on an optional parameter",
'making an "is rw" parameter optional dies with adequate error message';

throws_like { EVAL q[ sub foo($x is rw = 42) {} ] }, Exception,
message => "Cannot use 'is rw' on an optional parameter",
'making an "is rw" parameter optional dies with adequate error message';
}

# vim: ft=perl6

0 comments on commit 1014935

Please sign in to comment.