Skip to content

Commit 016d029

Browse files
committed
Adapt tests for recent change in Exception type
Because of Rakudo change rakudo/rakudo#1073
1 parent 6d781bc commit 016d029

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

S06-signature/types.t

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use lib <t/spec/packages>;
33
use Test;
44
use Test::Util;
55

6-
plan 18;
6+
plan 19;
77

88
sub f($x) returns Int { return $x };
99

@@ -39,12 +39,30 @@ dies-ok { g('m') }, 'type check forbids bad implicit return';
3939

4040
# RT #126124
4141
{
42-
throws-like { sub f(Mu:D $a) {}; f(Int) }, Exception,
43-
message => /'instance of type Mu' .+ 'type object'/,
44-
'type shown in the exception message is the right one';
45-
throws-like { sub f(Mu:U $a) {}; f(123) }, Exception,
46-
message => /'object of type Mu' .+ 'object instance'/,
47-
'type shown in the exception message is the right one';
42+
throws-like { sub f(Mu:D $a) {}; f(Int) }, X::Parameter::InvalidConcreteness,
43+
expected => 'Mu',
44+
got => 'Int',
45+
param => '$a',
46+
routine => 'f',
47+
should-be-concrete => 'True',
48+
param-is-invocant => 'False',
49+
'expected and got types in the exception are the correct ones';
50+
throws-like { sub f(Mu:U $a) {}; f(123) }, X::Parameter::InvalidConcreteness,
51+
expected => 'Mu',
52+
got => 'Int',
53+
param => '$a',
54+
routine => 'f',
55+
should-be-concrete => 'False',
56+
param-is-invocant => 'False',
57+
'expected and got types in the exception are the correct ones';
58+
throws-like { UInt.abs }, X::Parameter::InvalidConcreteness,
59+
expected => 'Int',
60+
got => 'UInt',
61+
param => '<anon>',
62+
routine => 'abs',
63+
should-be-concrete => 'True',
64+
param-is-invocant => 'True',
65+
'expected and got types in the exception are the correct ones';
4866
}
4967

5068
# RT #129279

S32-exceptions/misc.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,10 @@ ok X::AdHoc.new.gist ~~ m:i/explain/,
793793
"X::AdHoc.new.gist mentions the word 'explain'";
794794

795795
for <fail die throw rethrow resumable resume> -> $meth {
796-
throws-like 'X::NYI.' ~ $meth, Exception,
797-
message => rx/equire.*instance.*type\sobject/;
796+
throws-like 'X::NYI.' ~ $meth, X::Parameter::InvalidConcreteness,
797+
should-be-concrete => 'True',
798+
param-is-invocant => 'True',
799+
routine => $meth;
798800
}
799801

800802
# RT #125642

0 commit comments

Comments
 (0)