summaryrefslogtreecommitdiff
path: root/t/05text-errors-with-file-handles.t
diff options
context:
space:
mode:
Diffstat (limited to 't/05text-errors-with-file-handles.t')
-rw-r--r--t/05text-errors-with-file-handles.t52
1 files changed, 52 insertions, 0 deletions
diff --git a/t/05text-errors-with-file-handles.t b/t/05text-errors-with-file-handles.t
new file mode 100644
index 0000000..dd36b33
--- /dev/null
+++ b/t/05text-errors-with-file-handles.t
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use Error qw(:try);
+
+BEGIN
+{
+ use File::Spec;
+ use lib File::Spec->catdir(File::Spec->curdir(), "t", "lib");
+ use MyDie;
+}
+
+package MyError::Foo;
+
+use vars qw(@ISA);
+
+@ISA=(qw(Error));
+
+package main;
+
+my $ok = 1;
+eval
+{
+ try
+ {
+ MyDie::mydie();
+ }
+ catch MyError::Foo with
+ {
+ my $err = shift;
+ $ok = 0;
+ };
+};
+
+my $err = $@;
+
+# TEST
+ok($ok, "Not MyError::Foo");
+
+# TEST
+ok($err->isa("Error::Simple"), "Testing");
+
+# TEST
+is($err->{-line}, 16, "Testing for correct line number");
+
+# TEST
+ok(($err->{-file} =~ m{MyDie\.pm$}), "Testing for correct module");
+