#!./perl -w
BEGIN {
chdir 't' if -d 't';
}
use strict;
use Devel::SelfStubber;
# ensure correct output ordering for system() calls
print "1..12\n";
my @cleanup;
END {
}
}
my $inlib = "SSI-$$";
while (<DATA>) {
if (/^\#{16,}\s+(.*)/) {
my $f = $1;
} else {
print FH;
}
}
{
select FH;
select STDOUT;
print "ok 1\n";
my @A = <FH>;
print "ok 2\n";
} else {
print "not ok 2\n";
print "# $_" foreach (@A);
}
}
{
select FH;
select STDOUT;
print "ok 3\n"; # Checking that we did not die horribly.
my @B = <FH>;
print "ok 4\n";
} else {
print "not ok 4\n";
print "# $_" foreach (@B);
}
}
{
select FH;
select STDOUT;
print "ok 5\n"; # Checking that we did not die horribly.
my @C = <FH>;
print "ok 6\n";
} else {
print "not ok 6\n";
print "# $_" foreach (@C);
}
}
# "wrong" and "right" may change if SelfLoader is changed.
# extra line feeds for MBX IPC
}
;
# warn "$key $val $$right{$key}";
return 1
}
return;
}
}
}
# Now test that the module tree behaves "wrongly" as expected
print ${module}->foo;
";
}
{
my %output;
=~ s/\'s foo//;
}
} else {
print "ok 7\n";
}
}
my $lib="SSO-$$";
undef $/;
select FH;
# This will die for any module with no __DATA__
} else {
print $contents;
}
select STDOUT;
}
print "ok 8\n";
{
my %output;
=~ s/\'s foo//;
}
} else {
print "ok 9\n";
}
}
# Check that the DATA handle stays open
# Possibly a pointless test as this doesn't really verify that it's been
# stubbed.
# But check that the documentation after the __END__ survived.
$_ = <FH>;
if (/Did the documentation here survive\?/) {
print "ok 12\n";
} else {
print "not ok 12 # information after an __END__ token seems to be lost\n";
}
################ Parent.pm
sub foo {
return __PACKAGE__;
}
1;
################ Child.pm
require Parent;
@ISA = 'Parent';
use SelfLoader;
1;
sub foo {
return __PACKAGE__;
}
################ Proto.pm
use SelfLoader;
1;
}
################ Attribs.pm
use SelfLoader;
1;
}
my $a;
\$a;
}
################ Data.pm
use SelfLoader;
1;
sub ok {
print <DATA>;
}
ok 10
################ End.pm
use SelfLoader;
1;
sub lime {
print "ok 11\n";
}