summaryrefslogtreecommitdiff
path: root/t/09dollar-at.t
diff options
context:
space:
mode:
Diffstat (limited to 't/09dollar-at.t')
-rw-r--r--t/09dollar-at.t36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/09dollar-at.t b/t/09dollar-at.t
new file mode 100644
index 0000000..7a46b16
--- /dev/null
+++ b/t/09dollar-at.t
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Error qw(:try);
+use Test::More tests => 8;
+
+my $dollar_at;
+my $arg_0;
+
+try {
+ throw Error::Simple( "message" );
+}
+catch Error::Simple with {
+ $arg_0 = shift;
+ $dollar_at = $@;
+};
+
+ok( defined $arg_0, 'defined( $_[0] ) after throw/catch' );
+ok( defined $dollar_at, 'defined( $@ ) after throw/catch' );
+ok( ref $arg_0 && $arg_0->isa( "Error::Simple" ), '$_[0]->isa( "Error::Simple" ) after throw/catch' );
+ok( ref $dollar_at && $dollar_at->isa( "Error::Simple" ), '$@->isa( "Error::Simple" ) after throw/catch' );
+
+try {
+ throw Error::Simple( "message" );
+}
+otherwise {
+ $arg_0 = shift;
+ $dollar_at = $@;
+};
+
+ok( defined $arg_0, 'defined( $_[0] ) after throw/otherwise' );
+ok( defined $dollar_at, 'defined( $@ ) after throw/otherwise' );
+ok( ref $arg_0 && $arg_0->isa( "Error::Simple" ), '$_[0]->isa( "Error::Simple" ) after throw/otherwise' );
+ok( ref $dollar_at && $dollar_at->isa( "Error::Simple" ), '$@->isa( "Error::Simple" ) after throw/otherwise' );