Acme-EyeDrops

 view release on metacpan or  search on metacpan

t/05_Parrot.t  view on Meta::CPAN

$/ = undef;
$x = <0>;
close 0;
$x =~ tr/!-~/#/;
print $x;
PROG
$prog = sightly({ Shape         => 'japh',
                  SourceString  => $src,
                  InformHandler => sub {},
                  Regex         => 1 } );
build_file($tmpf, $prog);

# This one used to be OK with -Mstrict but not as of perl 5.8.4.
# From the perl 5.8.4 perldelta:
#   Pragmata are now correctly propagated into (?{...}) constructions in regexps.
#   Code such as
#     my $x = qr{ ... (??{ $x }) ... };
#   will now (correctly) fail under use strict.
#   (As the inner $x is and has always referred to $::x)
$outstr = `$^X -Tw $tmpf`;
$rc = $? >> 8;
$rc == 0 or print "not ";
++$itest; print "ok $itest - self-printing japh rc\n";
$outstr =~ s/^.+\n// if $] >= 5.017;   # remove leading use re 'eval' line
$outstr eq $japhstr or print "not ";
++$itest; print "ok $itest - self-printing japh output\n";

# Camel helloworld.pl (FillerVar=';')---------------

$prog = sightly({ Shape         => 'camel',
                  SourceString  => $hellostr,
                  FillerVar     => ';',
                  InformHandler => sub {},
                  Regex         => 1 } );
test_one('Camel helloworld fillervar=;', "hello world\n", $camelstr);

# Camel helloworld.pl (FillerVar=';#')--------------

$prog = sightly({ Shape         => 'camel',
                  SourceString  => $hellostr,
                  FillerVar     => ';#',
                  InformHandler => sub {},
                  Regex         => 1 } );
test_one('Camel helloworld fillervar=;#', "hello world\n", $camelstr);

# Camel helloworld.pl (FillerVar='')----------------

$prog = sightly({ Shape         => 'camel',
                  SourceString  => $hellostr,
                  FillerVar     => '',
                  InformHandler => sub {},
                  Regex         => 1 } );
build_file($tmpf, $prog);
$outstr = `$^X -Tw -Mstrict $tmpf`;
$rc = $? >> 8;
$rc == 0 or print "not ";
++$itest; print "ok $itest - Camel helloworld fillervar= rc\n";
$outstr eq "hello world\n" or print "not ";
++$itest; print "ok $itest - Camel helloworld fillervar= output\n";
$prog =~ s/^use re 'eval';\n// if $] >= 5.017;   # remove leading use re 'eval' line
length($prog) eq 472 or print "not ";
++$itest; print "ok $itest - Camel helloworld fillervar= length\n";

# Yanick4 hellotest.pl -----------------(3 shapes)--

$prog = sightly({ Shape         => 'yanick4',
                  SourceString  => $helloteststr,
                  InformHandler => sub {},
                  Regex         => 1 } );
test_one('Yanick4 hellotest',
   "hello test 0\nhello test 1\nhello test 2\nhello test 3\n",
   $yanick4str x 3);

# Yanick4 hellotest.pl (FillerVar=';')--(3 shapes)--

$prog = sightly({ Shape         => 'yanick4',
                  SourceString  => $helloteststr,
                  FillerVar     => ';',
                  InformHandler => sub {},
                  Regex         => 1 } );
test_one('Yanick4 hellotest FillerVar=;',
   "hello test 0\nhello test 1\nhello test 2\nhello test 3\n",
   $yanick4str x 3);

# Yanick4 hellotest.pl (FillerVar='')---(3 shapes)--

$prog = sightly({ Shape         => 'yanick4',
                  SourceString  => $helloteststr,
                  FillerVar     => '',
                  InformHandler => sub {},
                  Regex         => 1 } );
build_file($tmpf, $prog);
$outstr = `$^X -Tw -Mstrict $tmpf`;
$rc = $? >> 8;
$rc == 0 or print "not ";
++$itest; print "ok $itest - Yanick4 hellotest FillerVar= rc\n";
$outstr eq "hello test 0\nhello test 1\nhello test 2\nhello test 3\n"
   or print "not ";
++$itest; print "ok $itest - Yanick4 helloworld fillervar= output\n";
$prog =~ tr/!-~/#/;
# Note: normal 'or' test is 'and' test on next line (hacky).
$prog eq $yanick4str x 3 and print "not ";
++$itest; print "ok $itest - Yanick4 helloworld fillervar= shape\n";

# siertri hellotest.pl (FillerVar=';')--(3 shapes)--

$prog = sightly({ Shape         => 'siertri',
                  Width         => 5,
                  SourceString  => $helloteststr,
                  FillerVar     => ';',
                  InformHandler => sub {},
                  Regex         => 1 } );
test_one('siertri hellotest FillerVar=;',
   "hello test 0\nhello test 1\nhello test 2\nhello test 3\n",
   $siertristr x 5);

# Camel helloworld.pl from local eye file ----------

build_file($tmpf2, $camelstr);
$prog = sightly({ Shape         => $tmpf2,
                  SourceString  => $hellostr,
                  InformHandler => sub {},



( run in 1.009 second using v1.01-cache-2.11-cpan-5a3173703d6 )