From: Yuval Kogman Date: Tue, 16 Sep 2008 18:07:55 +0000 (+0000) Subject: test last_error X-Git-Tag: 0.58~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=30ef61cde0646b72b5362f94d182adad1ce6abab;p=gitmo%2FMoose.git test last_error --- diff --git a/t/050_metaclasses/018_throw_error.t b/t/050_metaclasses/018_throw_error.t index e6eb723..8fce4f4 100644 --- a/t/050_metaclasses/018_throw_error.t +++ b/t/050_metaclasses/018_throw_error.t @@ -31,6 +31,7 @@ use Test::More 'no_plan';; has data => ( is => "ro" ); has line => ( isa => "Int", is => "ro" ); has file => ( isa => "Str", is => "ro" ); + has last_error => ( isa => "Any", is => "ro" ); package Baz; use metaclass ( @@ -46,7 +47,7 @@ my $line; sub blah { $line = __LINE__; shift->foo(4) } sub create_error { - eval { blah(shift) }; + eval { eval { die "Blah" }; blah(shift) }; ok( my $e = $@, "got some error" ); return { file => __FILE__, @@ -80,4 +81,5 @@ sub create_error { is( $e->{error}->line, $e->{line}, "line attr" ); is( $e->{error}->file, $e->{file}, "file attr" ); is_deeply( $e->{error}->data, [ $baz, 4 ], "captured args" ); + like( $e->{error}->last_error, qr/Blah/, "last error preserved" ); }