diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-03-25 20:07:47 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-03-25 20:07:47 +0000 |
commit | 141b0349aa40a641262780601db7dde04f77008d (patch) | |
tree | 14a34904186120dcb8fbd522493b8806838907c8 /gnu | |
parent | d6ad716d88d4432aa000be8e774981f2feafbaf0 (diff) |
import perl 5.16.3 from CPAN - worked on by Andrew Fresh and myself
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/perl/cpan/JSON-PP/t/099_binary.t | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/gnu/usr.bin/perl/cpan/JSON-PP/t/099_binary.t b/gnu/usr.bin/perl/cpan/JSON-PP/t/099_binary.t index a1bce5d2f96..56f23297fa0 100644 --- a/gnu/usr.bin/perl/cpan/JSON-PP/t/099_binary.t +++ b/gnu/usr.bin/perl/cpan/JSON-PP/t/099_binary.t @@ -1,45 +1,53 @@ -# copied over from JSON::XS and modified to use JSON::PP +# copied over from JSON::PP::XS and modified to use JSON::PP -use strict; -use warnings; use Test::More; -BEGIN { plan tests => 24576 }; +use strict; +BEGIN { plan tests => 2432 }; BEGIN { $ENV{PERL_JSON_BACKEND} = 0; } +BEGIN { + use lib qw(t); + use _unicode_handling; +} + use JSON::PP; +SKIP: { + skip "UNICODE handling is disabale.", 2432 unless $JSON::PP::can_handle_UTF16_and_utf8; sub test($) { my $js; $js = JSON::PP->new->allow_nonref(0)->utf8->ascii->shrink->encode ([$_[0]]); - ok ($_[0] eq ((decode_json $js)->[0]), " - 0"); + ok ($_[0] eq ((decode_json $js)->[0])); $js = JSON::PP->new->allow_nonref(0)->utf8->ascii->encode ([$_[0]]); - ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0], " - 1"); + ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0]); $js = JSON::PP->new->allow_nonref(0)->utf8->shrink->encode ([$_[0]]); - ok ($_[0] eq ((decode_json $js)->[0]), " - 2"); + ok ($_[0] eq ((decode_json $js)->[0])); $js = JSON::PP->new->allow_nonref(1)->utf8->encode ([$_[0]]); - ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0], " - 3"); + ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0]); $js = JSON::PP->new->allow_nonref(1)->ascii->encode ([$_[0]]); - ok ($_[0] eq JSON::PP->new->decode ($js)->[0], " - 4"); + ok ($_[0] eq JSON::PP->new->decode ($js)->[0]); $js = JSON::PP->new->allow_nonref(0)->ascii->encode ([$_[0]]); - ok ($_[0] eq JSON::PP->new->shrink->decode ($js)->[0], " - 5"); + ok ($_[0] eq JSON::PP->new->shrink->decode ($js)->[0]); $js = JSON::PP->new->allow_nonref(1)->shrink->encode ([$_[0]]); - ok ($_[0] eq JSON::PP->new->decode ($js)->[0], " - 6"); + ok ($_[0] eq JSON::PP->new->decode ($js)->[0]); $js = JSON::PP->new->allow_nonref(0)->encode ([$_[0]]); - ok ($_[0] eq JSON::PP->new->shrink->decode ($js)->[0], " - 7"); + ok ($_[0] eq JSON::PP->new->shrink->decode ($js)->[0]); } -srand 0; # doesn't help too much, but its at least more deterministic +srand 0; # doesn't help too much, but its at leats more deterministic -for (1..768) { +#for (1..768) { +for (1..64, 125..129, 255..257, 512, 704, 736, 768) { test join "", map chr ($_ & 255), 0..$_; test join "", map chr rand 255, 0..$_; test join "", map chr ($_ * 97 & ~0x4000), 0..$_; test join "", map chr (rand (2**20) & ~0x800), 0..$_; } +} |