Skip to content

Commit fd39f02

Browse files
committed
Test for typed exception
and not exact text content of the exception. Aligns the tests with rakudo/rakudo#1061 fix
1 parent b83882b commit fd39f02

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

S06-signature/optional.t

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,13 @@ throws-like 'sub opt($a = 1, $b) { }', X::Parameter::WrongOrder,
118118
}
119119

120120
# RT #79288
121-
## TODO: implement typed exception and check for that one instead of Exception
122121
{
123-
throws-like { EVAL q[ sub foo($x? is rw) {} ] }, Exception,
124-
message => "Cannot use 'is rw' on an optional parameter",
122+
throws-like sub foo($x? is rw) {}, X::Trait::Invalid,
123+
:type('is'), :subtype('rw'),
125124
'making an "is rw" parameter optional dies with adequate error message';
126125

127-
throws-like { EVAL q[ sub foo($x is rw = 42) {} ] }, Exception,
128-
message => "Cannot use 'is rw' on an optional parameter",
126+
throws-like sub foo($x is rw = 42) {}, X::Trait::Invalid,
127+
:type('is'), :subtype('rw'),
129128
'making an "is rw" parameter optional dies with adequate error message';
130129
}
131130

0 commit comments

Comments
 (0)