Acme-AsciiArtinator
view release on metacpan or search on metacpan
abstract: Embed Perl code in ASCII artwork
author:
- Marty O'Brien <mob@cpan.org>
license: perl
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
build_requires:
ExtUtils::MakeMaker: 0
requires:
Test::More: 0
no_index:
directory:
- t
- inc
generated_by: ExtUtils::MakeMaker version 6.54
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Makefile.PL view on Meta::CPAN
WriteMakefile(
NAME => 'Acme::AsciiArtinator',
AUTHOR => q{Marty O'Brien <mob@cpan.org>},
VERSION_FROM => 'lib/Acme/AsciiArtinator.pm',
ABSTRACT_FROM => 'lib/Acme/AsciiArtinator.pm',
($ExtUtils::MakeMaker::VERSION >= 6.3002
? ('LICENSE'=> 'perl')
: ()),
PL_FILES => {},
PREREQ_PM => {
'Test::More' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Acme-AsciiArtinator-*' },
);
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
close $fh;
print qq{Running test: $^X ascii-art-test-$ntest-$$.pl @test_argv < ascii-art-test-$ntest-$$.stdin\n} if $DEBUG;
$output = qx{$^X ascii-art-test-$ntest-$$.pl @test_argv < ascii-art-test-$ntest-$$.stdin};
unlink "ascii-art-test-$ntest-$$.stdin";
} else {
print qq{Running test: $^X ascii-art-test-$ntest-$$.pl @test_argv\n};
$output = qx{$^X ascii-art-test-$ntest-$$.pl @test_argv};
}
print "Ran pre-test # $ntest with argv: \"@test_argv\", stdin: \"@test_stdin\"\n";
$Acme::AsciiArtinator::TestOutput[$ntest] = $output;
unlink "ascii-art-test-$ntest-$$.pl";
} else {
carp "Could not write code to disk in order to run pre-test.\n";
}
} continue {
$ntest++;
}
###############################################
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
# 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];
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";
print STDERR $Acme::AsciiArtinator::TestOutput[$ntest];
print STDERR "\n", "-- " x 13, "\n";
print STDERR "Final results for test # $ntest:\n";
print STDERR $output;
print STDERR "\n", "-- " x 13, "\n\n";
}
} continue {
$ntest++;
}
return @output;
}
t/00-load.t view on Meta::CPAN
#!perl
use Test::More tests => 1;
BEGIN {
use_ok( 'Acme::AsciiArtinator' );
}
diag( "Testing Acme::AsciiArtinator $Acme::AsciiArtinator::VERSION, Perl $], $^X" );
t/01-artinate.t view on Meta::CPAN
#!perl
use Test::More tests => 6;
use Acme::AsciiArtinator;
use strict;
use warnings;
my $art = '
XXXXXXXXXXXXXXX
XXXXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXX
XXXXXXX
t/01-artinate.t view on Meta::CPAN
print STDERR @output;
ok($output =~ /print/);
ok($output =~ /Hello/);
ok($output =~ /;;/ || $output =~ /\{\w+\}/);
################################################
@output = asciiartinate( code => $code, art => $art, test_argv1 => [] );
ok(defined $Acme::AsciiArtinator::TestOutput[1]);
ok(not defined $Acme::AsciiArtinator::TestOutput[0]);
ok(not defined $Acme::AsciiArtinator::TestOutput[2]);
t/02-test_input.t view on Meta::CPAN
#!perl
use Test::More tests => 7;
use Acme::AsciiArtinator;
use strict;
use warnings;
my $art = '
XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX
XXXXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXX
t/02-test_input.t view on Meta::CPAN
my $code = '$_="rst";while(<>){print"Hello",", ","world!\n" if /st/;}';
my @input1 = ("hello world!\n",
"it's been nice knowing you\n",
"ist been nice\n");
my @output = asciiartinate( code => $code, art => $art,
test_argv1 => [], test_input1 => \@input1,
test_argv2 => ["hello"], test_input2 => [] );
ok(defined $Acme::AsciiArtinator::TestOutput[1]);
ok(not defined $Acme::AsciiArtinator::TestOutput[0]);
ok(defined $Acme::AsciiArtinator::TestOutput[2]);
ok(length $Acme::AsciiArtinator::TestOutput[2] == 0);
ok($Acme::AsciiArtinator::TestOutput[1] eq "Hello, world!\n");
ok($Acme::AsciiArtinator::TestResult[1] eq "PASS");
ok($Acme::AsciiArtinator::TestResult[2] eq "PASS");
t/10-tokenize.t view on Meta::CPAN
use Acme::AsciiArtinator;
use Test::More tests => 14;
# test some tokenizations
my @tokens = Acme::AsciiArtinator::tokenize_code('$A$B$CDE');
ok(@tokens == 6);
ok($tokens[5] eq "CDE");
@tokens = Acme::AsciiArtinator::tokenize_code('"$A$B$CDE"');
ok(@tokens == 1, "quoted string is one token");
t/19-tokenize-regex.t view on Meta::CPAN
use Acme::AsciiArtinator;
use Test::More tests => 10;
#################################
#
# test how things are tokenized
#
#################################
my $code = '$a=$b+$c;$d=$e**4';
my @tokens = Acme::AsciiArtinator::tokenize_code($code);
ok(@tokens == 16, "routine tokenize test");
t/pod-coverage.tt view on Meta::CPAN
use strict;
use warnings;
use Test::More;
# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
if $@;
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
if $@;
all_pod_coverage_ok();
( run in 0.601 second using v1.01-cache-2.11-cpan-4d50c553e7e )