| /openbsd-src/gnu/usr.bin/perl/cpan/JSON-PP/t/ |
| H A D | 002_error.t | 22 eval { JSON::PP->new->allow_nonref (1)->decode ('"\u1234\udc00"') }; ok $@ =~ /missing high /; 23 eval { JSON::PP->new->allow_nonref->decode ('"\ud800"') }; ok $@ =~ /missing low /; 24 eval { JSON::PP->new->allow_nonref (1)->decode ('"\ud800\u1234"') }; ok $@ =~ /surrogate pair /; 26 eval { JSON::PP->new->allow_nonref (0)->decode ('null') }; ok $@ =~ /allow_nonref/; 27 eval { JSON::PP->new->allow_nonref (1)->decode ('+0') }; ok $@ =~ /malformed/; 28 eval { JSON::PP->new->allow_nonref->decode ('.2') }; ok $@ =~ /malformed/; 29 eval { JSON::PP->new->allow_nonref (1)->decode ('bare') }; ok $@ =~ /malformed/; 30 eval { JSON::PP->new->allow_nonref->decode ('naughty') }; ok $@ =~ /null/; 31 eval { JSON::PP->new->allow_nonref (1)->decode ('01') }; ok $@ =~ /leading zero/; 32 eval { JSON::PP->new->allow_nonref->decode ('00') }; ok $@ =~ /leading zero/; [all …]
|
| H A D | 017_relaxed.t | 16 ok ('[1,2,3]' eq encode_json $json->decode (' [1,2, 3]')); 17 ok ('[1,2,4]' eq encode_json $json->decode ('[1,2, 4 , ]')); 18 ok (!eval { $json->decode ('[1,2, 3,4,,]') }); 19 ok (!eval { $json->decode ('[,1]') }); 21 ok ('{"1":2}' eq encode_json $json->decode (' {"1":2}')); 22 ok ('{"1":2}' eq encode_json $json->decode ('{"1":2,}')); 23 ok (!eval { $json->decode ('{,}') }); 25 ok ('[1,2]' eq encode_json $json->decode ("[1#,2\n ,2,# ] \n\t]"));
|
| H A D | 012_blessed.t | 35 ok ("ARRAY" eq ref $js->decode ("[]")); 36 ok (5 eq join ":", @{ $js->decode ('[{}]') }); 37 ok (6 eq join ":", @{ $js->decode ('[{"a":6}]') }); 38 ok (5 eq join ":", @{ $js->decode ('[{"a":4,"b":7}]') }); 41 ok (7 == $js->decode ('[{"a":4,"b":7}]')->[0]{b}); 42 ok (3 eq join ":", @{ $js->decode ('[{"a":3}]') }); 45 ok (7 == $js->decode ('[{"a":4,"b":7}]')->[0]{b}); 46 ok (9 eq join ":", @{ $js->decode ('[{"a":9}]') }); 49 ok (4 == $js->decode ('[{"a":4}]')->[0]{a}); 52 ok (4 == $js->decode ('[{"a":4}]')->[0]{a});
|
| H A D | 008_pc_base.t | 19 $obj = $pc->decode($js); 24 $obj = $pc->decode($js); 30 $obj = $pc->decode($js); 36 $obj = $pc->decode($js); 41 $obj = $pc->decode($js); 46 $obj = $pc->decode($js); 52 $obj = $pc->decode($js); 57 $obj = $pc->decode($js); 63 $obj = $pc->decode($js); 69 $obj = $pc->decode($js); [all …]
|
| H A D | 108_decode.t | 2 # decode on Perl 5.005, 5.6, 5.8 or later 21 is($json->decode(q|"ü"|), "ü"); # utf8 22 is($json->decode(q|"\u00fc"|), "\xfc"); # latin1 23 is($json->decode(q|"\u00c3\u00bc"|), "\xc3\xbc"); # utf8 27 is($json->decode(($isASCII) ? q|"\u00e3\u0081\u0082"| 31 utf8::decode($str); # usually UTF-8 flagged on, but no-op for 5.005. 33 is($json->decode(q|"\u3042"|), $str); 38 my $utf8 = $json->decode(q|"\ud809\udc00"|); 44 eval { $json->decode(q|{"action":"foo" "method":"bar","tid":1}|) };
|
| H A D | 003_types.t | 14 ok (!defined JSON::PP->new->allow_nonref (1)->decode ('null')); 15 ok (JSON::PP->new->allow_nonref (1)->decode ('true') == 1); 16 ok (JSON::PP->new->allow_nonref (1)->decode ('false') == 0); 18 my $true = JSON::PP->new->allow_nonref (1)->decode ('true'); 21 my $false = JSON::PP->new->allow_nonref (1)->decode ('false'); 29 ok (JSON::PP->new->allow_nonref (1)->decode ('5') == 5); 30 ok (JSON::PP->new->allow_nonref (1)->decode ('-5') == -5); 31 ok (JSON::PP->new->allow_nonref (1)->decode ('5e1') == 50); 32 ok (JSON::PP->new->allow_nonref (1)->decode ('-333e+0') == -333); 33 ok (JSON::PP->new->allow_nonref (1)->decode ('2.5') == 2.5); [all …]
|
| H A D | 013_limit.t | 18 ok (!eval { $js->decode (("[" x ($def + 1)) . ("]" x ($def + 1))) }); 19 ok (ref $js->decode (("[" x $def) . ("]" x $def))); 20 ok (ref $js->decode (("{\"\":" x ($def - 1)) . "[]" . ("}" x ($def - 1)))); 21 ok (!eval { $js->decode (("{\"\":" x $def) . "[]" . ("}" x $def)) }); 23 ok (ref $js->max_depth (32)->decode (("[" x 32) . ("]" x 32))); 31 ok (eval { ref $js->max_size (8)->decode ("[ ]") }); 32 eval { $js->max_size (8)->decode ("[ ]") }; ok ($@ =~ /max_size/);
|
| H A D | 005_dwiw_decode.t | 21 my $data = $json_obj->decode($json_str); 56 $data = $json_obj->decode($json_str); 60 $data = $json_obj->decode($json_str); 64 $data = $json_obj->decode($json_str); 68 $data = $json_obj->decode($json_str); 72 $data = $json_obj->decode($json_str); 76 $data = $json_obj->decode($json_str);
|
| H A D | 099_binary.pl | 27 ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0], " - 1"); 32 ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0], " - 3"); 35 ok ($_[0] eq JSON::PP->new->decode ($js)->[0], " - 4"); 37 ok ($_[0] eq JSON::PP->new->shrink->decode ($js)->[0], " - 5"); 40 ok ($_[0] eq JSON::PP->new->decode ($js)->[0], " - 6"); 42 ok ($_[0] eq JSON::PP->new->shrink->decode ($js)->[0], " - 7");
|
| H A D | 009_pc_extra_number.t | 18 $obj = $pc->decode($js); 22 $obj = $pc->decode($js); 27 $obj = $pc->decode($js); 31 $obj = $pc->decode($js); 36 $obj = $pc->decode($js);
|
| H A D | 011_pc_expo.t | 17 $obj = $pc->decode($js); 23 $obj = $pc->decode($js); 31 $obj = $pc->decode($js); 38 $obj = $pc->decode($js); 48 $obj = $pc->decode($js); 54 $obj = $pc->decode($js);
|
| H A D | 020_faihu.t | 11 use Encode qw(encode decode); 19 $roundtrip = $js->decode($faihu_json); 24 $roundtrip = $js->decode ($faihu_json); 29 $roundtrip = $js->decode( decode 'UTF-16BE', $faihu_json);
|
| H A D | 001_utf8.t | 21 eval { JSON::PP->new->allow_nonref (1)->utf8 (1)->decode ('"¶"') }; 24 is (JSON::PP->new->allow_nonref (1)->decode ('"¶"'), "¶"); 25 is (JSON::PP->new->allow_nonref (1)->decode ('"\u00b6"'), "¶"); 26 is (JSON::PP->new->allow_nonref (1)->decode ('"\ud801\udc02' . "\x{10204}\""), "\x{10402}\x{10204}"… 31 is (JSON::PP->new->allow_nonref (1)->decode ('"\"\n\\\\\r\t\f\b"'), "\"$controls");
|
| H A D | 107_allow_singlequote.t | 12 eval q| $json->decode("{'foo':'bar'}") |; 18 is($json->decode(q|{'foo':"bar"}|)->{foo}, 'bar'); 19 is($json->decode(q|{'foo':'bar'}|)->{foo}, 'bar'); 20 is($json->allow_barekey->decode(q|{foo:'bar'}|)->{foo}, 'bar');
|
| /openbsd-src/gnu/usr.bin/perl/cpan/Encode/t/ |
| H A D | Unicode.t | 24 use Encode qw(encode decode find_encoding); 63 is($nasty, decode('UTF-16BE', $n_16be), qq{decode UTF-16BE}); 64 is($nasty, decode('UTF-16LE', $n_16le), qq{decode UTF-16LE}); 65 is($nasty, decode('UTF-32BE', $n_32be), qq{decode UTF-32BE}); 66 is($nasty, decode('UTF-32LE', $n_32le), qq{decode UTF-32LE}); 70 is($nasty, decode('UT [all...] |
| H A D | fallback.t | 62 $dst = $utf8->decode($src, FB_DEFAULT); 72 eval{ $dst = $utf8->decode($src, FB_CROAK) }; 82 eval{ $dst = $utf8->decode($src, FB_CROAK) }; 92 $dst = $utf8->decode($src, FB_QUIET); 108 $dst = $utf8->decode($src, FB_WARN); 122 $dst = $utf8->decode($src, WARN_ON_ERR); 134 $dst = $ascii->decode($src, FB_PERLQQ); 135 is($dst, $up, "FB_PERLQQ decode"); 136 is($src, $ao, "FB_PERLQQ residue decode"); 144 $dst = $ascii->decode( [all...] |
| H A D | decode.t | 2 # $Id: decode.t,v 1.5 2019/01/31 04:26:40 dankogai Exp $ 5 use Encode qw(decode_utf8 FB_CROAK find_encoding decode); 23 croak_ok { Encode::decode('utf-8', $orig2, FB_CROAK) }; 31 is($latin1->decode($1), $orig, '[cpan #115168] passing magic regex globals to decode'); 35 is($latin1->decode(*a), '*main::'.$orig, '[cpan #115168] passing typeglobs to decode'); 40 is($latin1->decode($1), "\N{U+0080}", 'passing magic regex to latin1 decode'); 44 is($latin1->decode(*a), "*main::\N{U+0080}", 'passing typeglob to latin1 decode'); 67 is(Encode::decode('utf-8', $1), "\N{U+C0}", 'passing magic regex to UTF-8 decode'); 71 is(Encode::decode('utf-8', *a), "*main::\N{U+C0}", 'passing typeglob to UTF-8 decode');
|
| H A D | gsm0338.t | 56 is decode( "gsm0338", $c, $chk ), $u, 57 sprintf( "decode \\x%02X", ord($c) ); 58 eval { decode( "gsm0338", $c . "\xff", $chk | Encode::FB_CROAK ) }; 64 is decode( "gsm0338", "\x00" . $c ), '@' . decode( "gsm0338", $c ), 65 sprintf( '@: decode \x00+\x%02X', ord($c) ); 70 is decode( "gsm0338", $ecs, $chk ), $unesc_seq{$ecs}, 71 sprintf( "ESC: decode ESC+\\x%02X", ord($c) ); 76 is decode( "gsm0338", $ecs, $chk ), 78 sprintf( "decode ES [all...] |
| H A D | mime-header.t | 95 # decode only known MIME charsets, do not crash on invalid 154 # do not decode invalid q words 157 # do not decode invalid b words 161 # RT114034 - utf8, UTF8 and also utf-8-strict are invalid MIME charset, do not decode it 226 is Encode::decode("MIME-B", $b) => $d, info("decode base64", $b => $d); 227 is Encode::decode("MIME-Q", $q) => $d, info("decode qp", $b => $d); 234 is Encode::decode("MIME-Header", $e) => $d, info("decode defaul [all...] |
| H A D | utf32warnings.t | 112 …my $ret = $enc->decode( $valid, Encode::WARN_ON_ERR | Encode::ONLY_PRAGMA_WARNINGS | Encode::LEAVE… 113 …is($warn, undef, "Calling decode on UTF32-LE encode object with valid string produces no warnings"… 114 …is($ret, "a", "Calling decode on UTF32-LE encode object with valid string returns correct output"); 120 … $enc->decode( $invalid, Encode::WARN_ON_ERR | Encode::ONLY_PRAGMA_WARNINGS | Encode::LEAVE_SRC ); 121 …like($warn, qr/may not be portable.* at $script line /, "Calling decode on UTF32-LE encode object … 127 … $enc->decode( $invalid, Encode::WARN_ON_ERR | Encode::ONLY_PRAGMA_WARNINGS | Encode::LEAVE_SRC ); 128 …is($warn, undef, "Warning from decode method of UTF32-LE encode object can be silenced via no warn… 134 … $enc->decode( $invalid, Encode::WARN_ON_ERR | Encode::ONLY_PRAGMA_WARNINGS | Encode::LEAVE_SRC ); 135 …is($warn, undef, "Warning from decode method of UTF32-LE encode object can be silenced via no warn… 141 $enc->decode( $invalid, Encode::WARN_ON_ERR | Encode::LEAVE_SRC ); [all …]
|
| H A D | truncated_utf8.t | 34 is(decode("UTF-8", "\xfd\xfe"), "\x{fffd}" x 2); 35 is(decode("UTF-8", "\xfd\xfe\xff"), "\x{fffd}" x 3); 36 is(decode("UTF-8", "\xfd\xfe\xff\xe0"), "\x{fffd}" x 4); 37 is(decode("UTF-8", "\xfd\xfe\xff\xe0\xe1"), "\x{fffd}" x 5); 38 is(decode("UTF-8", "\xc1\x9f"), "\x{fffd}"); 39 is(decode("UTF-8", "\xFF\x80\x90\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80"), "\x{fffd}"); 40 is(decode("UTF-8", "\xF0\x80\x80\x80"), "\x{fffd}");
|
| H A D | undef.t | 6 use Encode qw(encode decode find_encoding); 22 is($enc->decode(undef), undef, "find_encoding('$name')->decode(undef) returns undef"); 24 is(decode($name, undef), undef, "decode('$name', undef) returns undef");
|
| H A D | Encode.t | 18 use Encode qw(from_to encode decode 34 my $uni = $sym->decode(encode(ascii => 'a')); 37 is "B",decode(ascii => substr($str,0,1)),"Symbol 'B' does not map to Beta"; 44 $uni = $tab->decode($str); 120 is decode('utf8',$o),$c,"utf8 decode by name broken for $i"; 142 ok(decode(latin1 => Encode::Dummy->new("foobar")), "foobar"); 163 decode($name, $kopy, Encode::FB_CROAK); 164 is $key, "whatever", "decode $name with shared hash key scalars"; 168 decode( [all...] |
| H A D | rt85489.t | 40 ok Encode::is_utf8($str), "UTF8 flag is set on input string before ascii decode"; 41 $ascii->decode($str); 42 ok Encode::is_utf8($str), "UTF8 flag is set on input string after ascii decode"; 46 ok Encode::is_utf8($str), "UTF8 flag is set on input string before Encode::decode ascii"; 47 Encode::decode("ascii", $str); 48 ok Encode::is_utf8($str), "UTF8 flag is set on input string after Encode::decode ascii";
|
| H A D | utf8warnings.t | 6 use Encode qw(encode decode FB_CROAK LEAVE_SRC); 20 ok ! defined eval { decode('UTF-8', "\xed\xa0\x80", FB_CROAK | LEAVE_SRC) }, 'Surrogate UTF-8 byte … 23 decode('UTF-8', "\xed\xa0\x80", sub { @invalid = @_; return ""; }); 26 ok ! defined eval { decode('UTF-8', "\xed\xa0", FB_CROAK | LEAVE_SRC) }, 'Invalid byte sequence \xE… 29 decode('UTF-8', "\xed\xa0", sub { @invalid = @_; return ""; }); 32 ok ! defined eval { decode('utf8', "\xed\xa0", FB_CROAK | LEAVE_SRC) }, 'Invalid byte sequence \xED… 34 decode('utf8', "\xed\xa0", sub { @invalid = @_; return ""; });
|