diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-06-26 22:57:41 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-06-26 22:57:41 +0000 |
commit | cf0894e4fcf980767c57734e9a3ddad3c35da7d2 (patch) | |
tree | 92572ab67588d73e849f2ccf26ca55e858cba870 /t/misc_errors.t | |
download | Sub-Install-tarball-master.tar.gz |
Sub-Install-0.928HEADSub-Install-0.928master
Diffstat (limited to 't/misc_errors.t')
-rw-r--r-- | t/misc_errors.t | 23 |
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"); +} |