Blame t/SI_install.t

Packit 1c5632
use Sub::Install;
Packit 1c5632
Sub::Install::install_installers('UNIVERSAL');
Packit 1c5632
Packit 1c5632
# This test, from here on out, is the verbatim "install.t" test from
Packit 1c5632
# Sub::Installer 0.0.2
Packit 1c5632
Packit 1c5632
use Test::More 'no_plan';
Packit 1c5632
use Scalar::Util qw/reftype/;
Packit 1c5632
use warnings;
Packit 1c5632
Packit 1c5632
# Install a sub in a package...
Packit 1c5632
Packit 1c5632
my $sub_ref = main->install_sub({ ok1 => \&ok });
Packit 1c5632
Packit 1c5632
is reftype $sub_ref, 'CODE'                  => 'install returns code ref';
Packit 1c5632
Packit 1c5632
is_deeply \&ok, $sub_ref                 => 'install returns correct code ref';
Packit 1c5632
Packit 1c5632
ok1(1                                    => 'installed sub runs');
Packit 1c5632
Packit 1c5632
Packit 1c5632
# Install the same sub in the same package...
Packit 1c5632
Packit 1c5632
$SIG{__WARN__} = sub { ok 1 => 'warned as expected' if $_[0] =~ /redefined/ };
Packit 1c5632
Packit 1c5632
Packit 1c5632
$sub_ref = main->install_sub({ ok1 => \&is });
Packit 1c5632
Packit 1c5632
is reftype $sub_ref, 'CODE'                  => 'install2 returns code ref';
Packit 1c5632
Packit 1c5632
is_deeply \&is, $sub_ref                 => 'install2 returns correct code ref';
Packit 1c5632
Packit 1c5632
ok1(1,1                                  => 'installed sub reruns');
Packit 1c5632
Packit 1c5632
# Install in another package...
Packit 1c5632
Packit 1c5632
$sub_ref = Other->install_sub({ ok2 => \&ok });
Packit 1c5632
Packit 1c5632
is reftype $sub_ref, 'CODE'                  => 'install2 returns code ref';
Packit 1c5632
Packit 1c5632
is_deeply \&ok, $sub_ref                 => 'install2 returns correct code ref';
Packit 1c5632
Packit 1c5632
ok1(1,1                                  => 'installed sub reruns');
Packit 1c5632
Packit 1c5632
package Other;
Packit 1c5632
Packit 1c5632
ok2(1                                    => 'remotely installed sub runs');