Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more exception tests

  • Loading branch information...
commit 5c0802db6772ed0129494f5b42ffd89ee013ca12 1 parent 5f45cb4
@moritz moritz authored
Showing with 10 additions and 1 deletion.
  1. +8 −1 S04-statements/try.t
  2. +2 −0  S32-exceptions/misc.t
View
9 S04-statements/try.t
@@ -4,7 +4,7 @@ use Test;
# L<S04/"Statement parsing"/"or try {...}">
-plan 21;
+plan 23;
{
# simple try
@@ -129,6 +129,13 @@ plan 21;
isa_ok $!, X::AdHoc, 'die($non-exception) creates an X::AdHoc';
ok $!.payload === $p, '$!.payload is the argument to &die';
is $!.Str, 'something exceptional', '$!.Str uses the payload';
+
+ class MyEx is Exception {
+ has $.s;
+ }
+ try MyEx.new(s => 'bar').throw;
+ isa_ok $!, MyEx, 'Can throw subtypes of Exception and get them back';
+ is $!.s, 'bar', '... and got the right object back';
}
done;
View
2  S32-exceptions/misc.t
@@ -131,4 +131,6 @@ throws_like '1∞', X::Syntax::Confused;
throws_like 'm:i(@*ARGS[0])/foo/', X::Value::Dynamic;
throws_like 'my enum Foo (:x(@*ARGS[0]))', X::Value::Dynamic;
+throws_like 'self', X::Syntax::Self::WithoutObject;
+
done;
Please sign in to comment.
Something went wrong with that request. Please try again.