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/12wrong-error-var.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/12wrong-error-var.t')
-rw-r--r-- | t/12wrong-error-var.t | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/t/12wrong-error-var.t b/t/12wrong-error-var.t new file mode 100644 index 0000000..888c723 --- /dev/null +++ b/t/12wrong-error-var.t @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 2; + +use Error qw(:try); + +try { + eval { + throw Error::Simple "This is caught by eval, not by try."; + }; + + # TEST + ok (($@ && $@ =~ /This is caught by eval, not by try/), + "Checking that eval { ... } is sane" + ); + + print "# Error::THROWN = $Error::THROWN\n"; + + die "This is a simple 'die' exception."; + + # not reached +} +otherwise { + my $E = shift; + my $t = $Error::THROWN ? "$Error::THROWN" : ''; + print "# Error::THROWN = $t\n"; + $E ||= ''; + print "# E = $E\n"; + + # TEST + ok ("$E" =~ /This is a simple 'die' exception/, + "Checking that the argument to otherwise is the thrown exception" + ); +}; |