XML-Compile-1.64/ 0000755 0001750 0000144 00000000000 14705455321 014216 5 ustar 00markov users 0000000 0000000 XML-Compile-1.64/xt/ 0000755 0001750 0000144 00000000000 14705455321 014651 5 ustar 00markov users 0000000 0000000 XML-Compile-1.64/xt/99pod.t 0000644 0001750 0000144 00000000412 14703742164 016001 0 ustar 00markov users 0000000 0000000 #!/usr/bin/perl
use warnings;
use strict;
use Test::More;
BEGIN
{ eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
plan skip_all => "devel home uses OODoc"
if $ENV{MARKOV_DEVEL};
}
all_pod_files_ok();
XML-Compile-1.64/xt/92json.t 0000644 0001750 0000144 00000017434 14705454343 016176 0 ustar 00markov users 0000000 0000000 #!/usr/bin/env perl
# test json-friendly conversion
use warnings;
use strict;
use lib 'lib','t';
use TestTools;
use XML::Compile::Schema;
use XML::Compile::Tester;
use Test::More;
my @json_modules = qw/JSON::XS Cpanel::JSON::XS JSON::PP/;
my %has;
foreach my $module (@json_modules)
{ eval "require $module";
$has{$module} = 1 if !$@;
}
{
no warnings 'once';
if($has{'JSON::PP'} && JSON::PP->VERSION < 2.91)
{ diag "JSON::PP too old, requires 2.91 to work";
delete $has{'JSON::PP'};
}
if($has{'JSON::XS'} && JSON::XS->VERSION < 3.02)
{ diag "JSON::XS too old, requires 3.02 to work";
delete $has{'JSON::XS'};
}
if($has{'Cpanel::JSON::XS'} && Cpanel::JSON::XS->VERSION < 3.0201)
{ diag "Cpanel::JSON::XS too old, requires 3.0201 to work";
delete $has{'Cpanel::JSON::XS'};
}
}
keys %has
or plan skip_all => "No module of the following available: @json_modules";
plan 'no_plan';
my $schema = XML::Compile::Schema->new( <<__SCHEMA__ );
__SCHEMA__
ok(defined $schema);
my $json_serializer;
sub test_r_json($$$$;@)
{ my ($schema, $test, $xml, $expected_json, %args) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
SKIP: {
skip "No bignum implementation with " . ref($json_serializer), 1
if $args{need_bignum} && !$json_serializer->can('allow_bignum');
my $type = $test =~ m/\{/ ? $test : "{$TestNS}$test";
my $r = XML::Compile::Tester::reader_create($schema, $test, $type);
defined $r or return;
my $h = $r->($xml);
my $got_json = $json_serializer->encode($h);
is $got_json, $expected_json
, "json serialization (" . ref($json_serializer) . ") for $test";
}
}
my @default_compile_defaults =
( elements_qualified => 'NONE'
, json_friendly => 1
, sloppy_floats => 1
);
SKIP: foreach my $json_module (@json_modules)
{
$has{$json_module}
or skip "Skip tests with $json_module", 1;
diag "Running tests for $json_module";
$json_serializer = $json_module->new->utf8->canonical->allow_nonref;
if($json_serializer->can('allow_bignum'))
{ $json_serializer->allow_bignum;
set_compile_defaults @default_compile_defaults;
}
else
{
# for JSON::XS (lacks bignum support)
set_compile_defaults
@default_compile_defaults
, sloppy_integers => 1
, sloppy_floats => 1
;
}
test_r_json $schema, boolean => '0', 'false';
test_r_json $schema, boolean => 'false', 'false';
test_r_json $schema, boolean => '1', 'true';
test_r_json $schema, boolean => 'true', 'true';
test_r_json $schema, integer => '-123', '-123';
test_r_json $schema, integer => '0', '0';
test_r_json $schema, integer => '123', '123';
test_r_json $schema, long => '-1234', '-1234';
test_r_json $schema, long => '0', '0';
test_r_json $schema, long => '1234', '1234';
test_r_json $schema, long => '1234567890123456789', '1234567890123456789', need_bignum => 1;
test_r_json $schema, negativeInteger => '-123', '-123';
test_r_json $schema, nonNegativeInteger => '123', '123';
test_r_json $schema, nonNegativeInteger => '0', '0';
test_r_json $schema, nonPositiveInteger => '-123', '-123';
test_r_json $schema, nonPositiveInteger => '0', '0';
test_r_json $schema, positiveInteger => '123', '123';
test_r_json $schema, unsignedInt => '123', '123';
test_r_json $schema, unsignedLong => '1234567890123456789', '1234567890123456789', need_bignum => 1;
test_r_json $schema, byte => '-128', '-128';
test_r_json $schema, byte => '0', '0';
test_r_json $schema, byte => '127', '127';
test_r_json $schema, int => '-2147483648', '-2147483648';
test_r_json $schema, int => '0', '0';
test_r_json $schema, int => '2147483647', '2147483647';
test_r_json $schema, int => '+2147483647', '2147483647';
test_r_json $schema, short => '-32768', '-32768';
test_r_json $schema, short => '0', '0';
test_r_json $schema, short => '32767', '32767';
test_r_json $schema, 'unsignedByte', '0', '0';
test_r_json $schema, 'unsignedByte', '255', '255';
# Currently broken
# test_r_json $schema, 'decimal', '-99999999999999999999.9999', '-99999999999999999999.9999', need_bignum => 1;
test_r_json $schema, 'decimal', '-123.4560', '-123.456'; # trailing zero gets lost!
test_r_json $schema, 'decimal', '-123.456', '-123.456';
test_r_json $schema, 'decimal', '-123', '-123';
test_r_json $schema, 'decimal', '0', '0';
# Depends on the JSON parser
# test_r_json $schema, 'decimal', '0.0', '0.0'; # XXX .0 gets lost!
test_r_json $schema, 'decimal', '123', '123';
test_r_json $schema, 'decimal', '123.456', '123.456';
test_r_json $schema, 'decimal', '123.4560', '123.456';
# Currently broken
# test_r_json $schema, 'decimal', '99999999999999999999.9999', '99999999999999999999.9999', need_bignum => 1;
test_r_json $schema, 'float', '123.4560', '123.456';
test_r_json $schema, 'float', '-123.4560', '-123.456';
TODO:
{
local $TODO = "NaN/inf support partially buggy";
# see https://github.com/rurban/Cpanel-JSON-XS/issues/78
# JSON::XS has no option to prevent NaN/inf generation
test_r_json $schema, 'float', 'NaN', 'null'; # no Nan/Inf... support in JSON
test_r_json $schema, 'float', '-INF', 'null'; # no Nan/Inf... support in JSON
test_r_json $schema, 'float', '+INF', 'null'; # no Nan/Inf... support in JSON
}
test_r_json $schema, 'string', '', '""';
test_r_json $schema, 'string', 'non-empty', '"non-empty"';
test_r_json $schema, 'string', '€', qq{"\342\202\254"}; # euro sign
test_r_json $schema, 'complex', '', '{}';
test_r_json $schema, 'complex', '12', '{"elem":[1,2]}';
}
XML-Compile-1.64/html/ 0000755 0001750 0000144 00000000000 14705455321 015162 5 ustar 00markov users 0000000 0000000 XML-Compile-1.64/html/other/ 0000755 0001750 0000144 00000000000 14705455321 016303 5 ustar 00markov users 0000000 0000000 XML-Compile-1.64/html/other/manuals/ 0000755 0001750 0000144 00000000000 14705455321 017743 5 ustar 00markov users 0000000 0000000 XML-Compile-1.64/html/other/manuals/head.html 0000644 0001750 0000144 00000001212 14703742164 021530 0 ustar 00markov users 0000000 0000000
; All Manuals
XML::Compile
Documentation
version ,
|
All Manuals
|
all manuals
all methods and functions
all diagnostics
all details
|
XML-Compile-1.64/html/other/manuals/index.html 0000644 0001750 0000144 00000000501 14703742164 021736 0 ustar 00markov users 0000000 0000000
; All Methods