Data-Dumper-Compact

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;

use Data::Dumper::Compact;

my $can_j = eval { require JSON::Dumper::Compact; 1 };

DEEP: foreach my $example (glob('ex/deep*')) {
  my $contents = do { local (@ARGV, $/) = $example; <> };
  my $data = eval '+'.$contents;
  is(Data::Dumper::Compact->dump($data), $contents);
  if ($can_j) {
    (my $jfile = $example) =~ s/deep/jdeep/;
    next DEEP unless -e $jfile;
    my $jcont = do { local (@ARGV, $/) = $jfile; <> };
    is(my $res = JSON::Dumper::Compact->dump($data), $jcont);
    is(
      Data::Dumper::Compact->dump(JSON::Dumper::Compact->decode($res)),
      $contents,
    );
  }
}

done_testing;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.078 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )