added a test for errors in load_module resulting in "unknown error"
Christian Walde [Sat, 11 Feb 2012 18:29:42 +0000 (19:29 +0100)]
t/lib/base_class.pm [new file with mode: 0644]
t/lib/sub_class.pm [new file with mode: 0644]
t/load_module_error.t [new file with mode: 0644]

diff --git a/t/lib/base_class.pm b/t/lib/base_class.pm
new file mode 100644 (file)
index 0000000..c5dcaad
--- /dev/null
@@ -0,0 +1,7 @@
+use strictures;
+
+package base_class;
+use Moo;
+extends "marp";
+
+1;
diff --git a/t/lib/sub_class.pm b/t/lib/sub_class.pm
new file mode 100644 (file)
index 0000000..3959550
--- /dev/null
@@ -0,0 +1,7 @@
+use strictures;
+
+package sub_class;
+
+use Moo;
+
+extends 'base_class';
diff --git a/t/load_module_error.t b/t/load_module_error.t
new file mode 100644 (file)
index 0000000..464ef29
--- /dev/null
@@ -0,0 +1,14 @@
+use strictures;
+
+package load_module_error;
+
+use Test::More;
+
+use lib 't/lib';
+
+eval "use sub_class;";
+
+ok $@, "got a crash";
+unlike $@, qr/Unknown error/, "it came with a useful error message";
+
+done_testing;