1use Sub::Install qw(install_sub);
2use Test::More 'no_plan';
3
4use strict;
5use warnings;
6
7{ # you have to install /something/!
8  eval { install_sub({ into => "Doesn't::Matter" }); };
9
10  like($@, qr/code.+not optional/, "you must supply something to install");
11}
12
13{ # you can't just make names up and expect Sub::Install to know what you mean
14  eval { install_sub({ code => 'none_such', into => 'Whatever' }); };
15
16  like($@, qr/couldn't find subroutine/, "error on unfound sub name");
17}
18
19{ # can't install anonymous subs without a name
20  eval { install_sub({ code => sub { return 1; } }); };
21
22  like($@, qr/couldn't determine name/, "anon subs need names to install");
23}
24