List-Keywords

 view release on metacpan or  search on metacpan

t/70deparse.t  view on Meta::CPAN

{
   my ( $sub, $exp, $name ) = @_;

   my $got = $deparser->coderef2text( $sub );

   # Deparsed output is '{ ... }'-wrapped
   $got = ( $got =~ m/^{\n(.*)\n}$/s )[0];

   # Deparsed output will have a lot of pragmata and so on; just grab the
   # final line
   $got = ( split m/\n/, $got )[-1];
   $got =~ s/^\s+//;

   is( $got, $exp, $name );
}

is_deparsed
   sub { first { $_ > 10 } 1 .. 10 },
   'first {$_ > 10;} 1..10;',
   'first {}';



( run in 0.656 second using v1.01-cache-2.11-cpan-71847e10f99 )