diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-05-08 18:20:12 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-10-03 12:23:37 +0000 |
commit | 661707e7bd4282aeab5a2f6a8f02ca5731fd813f (patch) | |
tree | 9b32ff910278233ad929888499ca8380f2696582 /t/09dollar-at.t | |
download | error-perl-tarball-661707e7bd4282aeab5a2f6a8f02ca5731fd813f.tar.gz |
Imported from /srv/lorry/lorry-area/error-perl-tarball/Error-0.17018.tar.gz.baserock/morph
Diffstat (limited to 't/09dollar-at.t')
-rw-r--r-- | t/09dollar-at.t | 36 |
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' ); |