Acme-Echo

 view release on metacpan or  search on metacpan

t/after.t  view on Meta::CPAN

#!/usr/bin/perl

use IO::Scalar;
my ($out, $SH);
BEGIN {
  $SH = new IO::Scalar \$out;
};

use Acme::Echo qw/before/, 'src_fmt' => "CODE RAN WAS:<br>\n<pre>\n%s\n</pre>\n", fh => $SH;

use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
  $s += $_;
}

no Acme::Echo;

my $expected = do { local $/ = undef; <DATA> };
is( $out, $expected, "output matches" );
is( $s, 55, "s=55" );

__DATA__
CODE RAN WAS:<br>
<pre>

use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
  $s += $_;
}


</pre>



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