Skip to content

Commit

Permalink
Merge pull request #3304 from usev6/literal_to_rw_x_comp_test
Browse files Browse the repository at this point in the history
Add tests for catching error at compile time
  • Loading branch information
lizmat committed Nov 26, 2019
2 parents 5c2395b + d81212b commit 4181ca6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion t/02-rakudo/13-exceptions.t
@@ -1,6 +1,6 @@
use Test;

plan 1;
plan 3;

# GH #2739
# Prior to the fix the original exception would be lost hidden under 'no handler found' error.
Expand All @@ -9,4 +9,13 @@ throws-like q<sub foo ( ::T $val ) { my T $a is default($val); }; foo(42)>,
"exception isn't lost",
message => q<Default value '(Mu)' will never bind to a parameter of type T>;

# RT #129812
throws-like q[multi sub f(int $foo is rw) { }; f(42)],
X::Comp,
'calling multi sub that expects a rw native argument with a literal is caught at compile time';

throws-like q[multi sub f(Int $foo is rw) { }; f(42)],
X::Comp,
'calling multi sub that expects a rw non-native argument with a literal is caught at compile time';

done-testing;

0 comments on commit 4181ca6

Please sign in to comment.