Blame t/misc_errors.t

Packit 1c5632
use Sub::Install qw(install_sub);
Packit 1c5632
use Test::More 'no_plan';
Packit 1c5632
Packit 1c5632
use strict;
Packit 1c5632
use warnings;
Packit 1c5632
Packit 1c5632
{ # you have to install /something/!
Packit 1c5632
  eval { install_sub({ into => "Doesn't::Matter" }); };
Packit 1c5632
Packit 1c5632
  like($@, qr/code.+not optional/, "you must supply something to install");
Packit 1c5632
}
Packit 1c5632
Packit 1c5632
{ # you can't just make names up and expect Sub::Install to know what you mean
Packit 1c5632
  eval { install_sub({ code => 'none_such', into => 'Whatever' }); };
Packit 1c5632
Packit 1c5632
  like($@, qr/couldn't find subroutine/, "error on unfound sub name");
Packit 1c5632
}
Packit 1c5632
Packit 1c5632
{ # can't install anonymous subs without a name
Packit 1c5632
  eval { install_sub({ code => sub { return 1; } }); };
Packit 1c5632
Packit 1c5632
  like($@, qr/couldn't determine name/, "anon subs need names to install");
Packit 1c5632
}