summaryrefslogtreecommitdiff
path: root/t/misc_errors.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-06-26 22:57:41 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-06-26 22:57:41 +0000
commitcf0894e4fcf980767c57734e9a3ddad3c35da7d2 (patch)
tree92572ab67588d73e849f2ccf26ca55e858cba870 /t/misc_errors.t
downloadSub-Install-tarball-master.tar.gz
Diffstat (limited to 't/misc_errors.t')
-rw-r--r--t/misc_errors.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/misc_errors.t b/t/misc_errors.t
new file mode 100644
index 0000000..09892a5
--- /dev/null
+++ b/t/misc_errors.t
@@ -0,0 +1,23 @@
+use Sub::Install qw(install_sub);
+use Test::More 'no_plan';
+
+use strict;
+use warnings;
+
+{ # you have to install /something/!
+ eval { install_sub({ into => "Doesn't::Matter" }); };
+
+ like($@, qr/code.+not optional/, "you must supply something to install");
+}
+
+{ # you can't just make names up and expect Sub::Install to know what you mean
+ eval { install_sub({ code => 'none_such', into => 'Whatever' }); };
+
+ like($@, qr/couldn't find subroutine/, "error on unfound sub name");
+}
+
+{ # can't install anonymous subs without a name
+ eval { install_sub({ code => sub { return 1; } }); };
+
+ like($@, qr/couldn't determine name/, "anon subs need names to install");
+}