Acme-AsciiArtinator
view release on metacpan or search on metacpan
0.04 2009-11-25
Improved handling of regular expressions, which can be more flexible
when used with /x, /e modifiers
0.03 2009-11-05
Fixed issue with splitting special Perl vars across newlines
(you shouldn't).
0.02 2009-11-04
Improved padding algorithm, added hooks for pre- and post-testing.
0.01 2009-11-03
First version, released on an unsuspecting world.
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
my @output = <$fh>;
close $fh;
# test output
#
# make sure artinated code produces same outputs
# as the original code on the test cases.
#
$ntest = 1;
if (defined $opts{"test_argv1"}) {
print "Running post-tests on artinated code\n";
}
while (defined $opts{"test_argv$ntest"} || defined $opts{"test_input$ntest"}) {
my (@test_argv, @test_stdin) = ();
print "Testing output # $ntest:\n";
@test_argv = @{$opts{"test_argv$ntest"}} if defined $opts{"test_argv$ntest"};
@test_stdin = @{$opts{"test_input$ntest"}} if defined $opts{"test_input$ntest"};
my $fh;
next if !defined $Acme::AsciiArtinator::TestOutput[$ntest];
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
my $output = "";
if (defined $opts{"test_input$ntest"}) {
open($fh, ">", "ascii-art-test-$ntest-$$.stdin");
print $fh @test_stdin;
close $fh;
$output = qx{$^X "$OUTPUT" @test_argv < ascii-art-test-$ntest-$$.stdin};
unlink "ascii-art-test-$ntest-$$.stdin";
} else {
$output = qx{$^X "$OUTPUT" @test_argv};
}
print "Ran post-test # $ntest with argv: \"@test_argv\", stdin: \"@test_stdin\"\n";
if ($output eq $Acme::AsciiArtinator::TestOutput[$ntest]) {
print "Post-test # $ntest: PASS\n";
$Acme::AsciiArtinator::TestResult[$ntest] = "PASS";
} else {
print "Post-test # $ntest: FAIL\n";
$Acme::AsciiArtinator::TestResult[$ntest] = "FAIL";
print STDERR "-- " x 13, "\n";
print STDERR "Original results for test # $ntest:\n";
print STDERR "-- " x 7, "\n";
( run in 1.919 second using v1.01-cache-2.11-cpan-ceb78f64989 )