Acme-DotDotGone

 view release on metacpan or  search on metacpan

t/01-basics.t  view on Meta::CPAN

use Test::More;
use lib 'lib';

my $package = q|
use Acme::DotDotGone dot;
my $end = 'the world is ending';
print $end;
1;
|;

my $var = 'testing.pl';
open(FH, '>', $var)
    or die "Can't open memory file: $!\n";
print FH $package;
close FH;

qx(perl testing.pl);

open(FH, '<', $var)
    or die "Can't open memory file: $!\n";
my $file = do{ local $/, <FH> };
close FH;

is ($file, 'use Acme::DotDotGone;
.. . .. .. . .. .. . .. . . .. .. .. .. . . . . . . .. . . . . .. . . .. . . .. . .. . . .. .. . . .. .. .. . .. .. . . . .. . . .. .. . . . . . . .. . . .. . .. .. .. .. . . . . . . . .. . . .. .. .. . . .. . . . . .. . .. .. .. . . . . .. . .. .. ....

qx(perl testing.pl);

$file =~ s/DotDotGone;/DotDotGone panic;/;

open(FH, '>', $var)
    or die "Can't open memory file: $!\n";
print FH $file;
close FH;

qx(perl testing.pl);

open(FH, '<', $var)
    or die "Can't open memory file: $!\n";
$file = do{ local $/, <FH> };
close FH;

is($file, 'use Acme::DotDotGone;
my $end = \'the world is ending\';
print $end;
1;
');

unlink($var);

done_testing();



( run in 0.510 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )