From 661707e7bd4282aeab5a2f6a8f02ca5731fd813f Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 8 May 2012 18:20:12 +0000 Subject: Imported from /srv/lorry/lorry-area/error-perl-tarball/Error-0.17018.tar.gz. --- t/07try-in-obj-destructor.t | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 t/07try-in-obj-destructor.t (limited to 't/07try-in-obj-destructor.t') diff --git a/t/07try-in-obj-destructor.t b/t/07try-in-obj-destructor.t new file mode 100644 index 0000000..b15bff2 --- /dev/null +++ b/t/07try-in-obj-destructor.t @@ -0,0 +1,42 @@ +#!/usr/bin/perl -w + +use strict; + +use Test::More tests => 1; + +use Error qw/ :try /; + +package ErrorTest; +use Error qw/ :try /; + +sub new { + return bless {}, 'ErrorTest'; +} + +sub DESTROY { + my $self = shift; + try { 1; } otherwise { }; + return; +} + +package main; + +my $E; +try { + + my $y = ErrorTest->new(); +# throw Error::Simple("Object die"); + die "throw normal die"; + +} catch Error with { + $E = shift; +} otherwise { + $E = shift; +}; + +# TEST +is ($E->{'-text'}, "throw normal die", + "Testing that the excpetion is not trampeled" +); + + -- cgit v1.2.1