YAML-PP

 view release on metacpan or  search on metacpan

t/37.schema-perl.t  view on Meta::CPAN

#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use FindBin '$Bin';
use Data::Dumper;
use Scalar::Util ();
use YAML::PP;
use YAML::PP::Perl;

my $test_deep;
BEGIN {
    eval "use Test::Deep qw/ cmp_deeply /";
    unless ($@) {
      $test_deep = 1;
    }
}
unless ($test_deep) {
    plan skip_all => "No Test::Deep available";
    exit;
}

my $tests = require "$Bin/../examples/schema-perl.pm";

my $perl_no_objects = YAML::PP::Schema::Perl->new(
    classes => [],
    cyclic_refs => 'allow',
);
my $perl_no_objects_loadcode = YAML::PP::Schema::Perl->new(
    classes => [],
    loadcode => 1,
    cyclic_refs => 'allow',
);

my $yp_perl = YAML::PP::Perl->new(
    schema => [qw/ JSON Perl tags=!perl /],
    cyclic_refs => 'allow',
);
my $yp_perl_no_objects = YAML::PP::Perl->new(
    schema => [qw/ JSON /, $perl_no_objects],
    cyclic_refs => 'allow',
);
my $yp_loadcode = YAML::PP->new(
    schema => [qw/ JSON Perl +loadcode /],
    cyclic_refs => 'allow',
);
my $yp_loadcode_no_objects = YAML::PP->new(
    schema => [qw/ JSON /, $perl_no_objects_loadcode],
    cyclic_refs => 'allow',
);
my $yp_perl_two = YAML::PP::Perl->new(
    schema => [qw/ JSON Perl tags=!!perl /],
    cyclic_refs => 'allow',
);
my $yp_loadcode_two = YAML::PP->new(
    schema => [qw/ JSON Perl tags=!!perl +loadcode /],
    cyclic_refs => 'allow',
);
my $yp_loadcode_one_two = YAML::PP->new(
    schema => [qw/ JSON Perl tags=!perl+!!perl +loadcode /],
    cyclic_refs => 'allow',
);
my $yp_loadcode_two_one = YAML::PP->new(
    schema => [qw/ JSON Perl tags=!!perl+!perl +loadcode /],
    cyclic_refs => 'allow',
);
my $yp_perl_one_two = YAML::PP::Perl->new(
    schema => [qw/ JSON Perl tags=!perl+!!perl /],
    cyclic_refs => 'allow',
);
my $yp_perl_two_one = YAML::PP::Perl->new(
    schema => [qw/ JSON Perl tags=!!perl+!perl /],
    cyclic_refs => 'allow',
);
my $yp_no_dumpcode = YAML::PP::Perl->new(
    schema => [qw/ + Perl -dumpcode /],
);

my @tests = sort keys %$tests;
@tests = qw/
    array array_blessed
    hash hash_blessed
    scalarref scalarref_blessed



( run in 0.695 second using v1.01-cache-2.11-cpan-5735350b133 )