Acme-EyeDrops

 view release on metacpan or  search on metacpan

t/07_a.t  view on Meta::CPAN

$prog = join("", @lines);
$prog =~ s/^.+\n// if $] >= 5.017;   # remove leading use re 'eval' line
$prog =~ s/^## //mg; $prog =~ s/ ##$//mg; $prog =~ s/ +$//mg;
$prog eq $camelstr or print "not ";
++$itest; print "ok $itest\n";

# -------------------------------------------------
# This test failed prior to EyeDrops.pm version 1.41.

$prog = sightly({ Shape         => 'camel,camel',
                  SourceString  => $hellostr,
                  BorderWidth   => 2,
                  BorderGap     => 1,
                  Gap           => 3,
                  InformHandler => \&test_inform,
                  Regex         => 1 } );
build_file($tmpf, $prog);
$outstr = `$^X -w -Mstrict $tmpf`;
$rc = $? >> 8;
$rc == 0 or print "not ";
++$itest; print "ok $itest\n";
$outstr eq "hello world\n" or print "not ";
++$itest; print "ok $itest\n";
$prog =~ tr/!-~/#/;
@lines = split(/^/, $prog, -1);
scalar(@lines) > 6 or print "not ";
++$itest; print "ok $itest\n";
pop(@lines);pop(@lines);pop(@lines);
shift(@lines);shift(@lines);shift(@lines);
$prog = join("", @lines);
$prog =~ s/^.+\n// if $] >= 5.017;   # remove leading use re 'eval' line
$prog =~ s/^## //mg; $prog =~ s/ ##$//mg; $prog =~ s/ +$//mg;
$prog eq $camel2str or print "not ";
++$itest; print "ok $itest\n";

# -------------------------------------------------

$inform_string eq "1 shapes completed.\n" x 3 or print "not ";
++$itest; print "ok $itest\n";

# -------------------------------------------------
# ShapeString join v Shape/Gap multiple shapes

sightly( { ShapeString   => join("\n",
                            get_eye_string('camel'),
                            get_eye_string('mongers')),
           SourceString  => $hellostr,
           Gap           => 0,
           InformHandler => sub {},
           Regex         => 1 } )
eq
sightly( { Shape         => 'camel,mongers',
           SourceString  => $hellostr,
           Gap           => 1,
           InformHandler => sub {},
           Regex         => 1 } ) or print "not ";
++$itest; print "ok $itest - join v gap the same\n";

# -------------------------------------------------

unlink($tmpf) or die "error: unlink '$tmpf': $!";



( run in 0.720 second using v1.01-cache-2.11-cpan-39bf76dae61 )