Home
last modified time | relevance | path

Searched refs:JSON (Results 1 – 25 of 152) sorted by relevance

1234567

/openbsd-src/gnu/usr.bin/perl/cpan/JSON-PP/t/
H A D002_error.t1 # copied over from JSON::XS and modified to use JSON::PP
11 use JSON::PP;
15 eval { JSON::PP->new->encode ([\-1]) }; ok $@ =~ /cannot encode reference/;
16 eval { JSON::PP->new->encode ([\undef]) }; ok $@ =~ /cannot encode reference/;
17 eval { JSON::PP->new->encode ([\2]) }; ok $@ =~ /cannot encode reference/;
18 eval { JSON::PP->new->encode ([\{}]) }; ok $@ =~ /cannot encode reference/;
19 eval { JSON::PP->new->encode ([\[]]) }; ok $@ =~ /cannot encode reference/;
20 eval { JSON::PP->new->encode ([\\1]) }; ok $@ =~ /cannot encode reference/;
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 /;
[all …]
H A Drt_122270_old_xs_boolean.t1 # copied over from JSON::XS and modified to use JSON::PP
11 use JSON::PP;
14 skip "no JSON::XS < 3", 5 unless eval { require JSON::XS; JSON::XS->VERSION < 3 };
16 my $false = JSON::XS::false();
17 ok (JSON::PP::is_bool $false);
19 ok (!JSON::PP::is_bool $false);
20 ok (!JSON::PP::is_bool "JSON::PP::Boolean");
21 ok (!JSON::PP::is_bool {}); # GH-34
25 …skip "no Types::Serialiser 0.01", 5 unless eval { require JSON::XS; JSON::XS->VERSION(3.00); requi…
27 my $false = JSON::XS::false();
[all …]
H A D003_types.t1 # copied over from JSON::XS and modified to use JSON::PP
11 use JSON::PP;
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');
20 ok (JSON::PP::is_bool $true);
21 my $false = JSON::PP->new->allow_nonref (1)->decode ('false');
23 ok (JSON::PP::is_bool $false);
25 ok (!JSON::PP::is_bool $false);
[all …]
H A D052_object.t1 # copied over from JSON::XS and modified to use JSON::PP
3 package JSON::PP::freeze;
7 package JSON::PP::tojson;
21 use JSON::PP;
23 my $json = JSON::PP->new->convert_blessed->allow_tags->allow_nonref;
27 sub JSON::PP::tojson::TO_JSON {
29 ok (JSON::PP::tojson:: eq ref $_[0]);
34 my $obj = bless { k => 1 }, JSON::PP::tojson::;
43 sub JSON::PP::freeze::FREEZE {
45 ok ($_[1] eq "JSON");
[all …]
H A D118_boolean_values.t5 use JSON::PP;
11 *Dummy::True:: = *JSON::PP::Boolean::;
15 *Dummy::False:: = *JSON::PP::Boolean::;
28 if (eval "require JSON::PP; 1") {
29 push @tests, [JSON::PP::true(), JSON::PP::false(), 'JSON::PP::Boolean', 'JSON::PP::Boolean'];
40 my $json = JSON::PP->new;
52 skip "$true_class is not compatible with JSON::PP::Boolean", 2 if $incompat;
53 ok $new_true->isa('JSON::PP::Boolean'), "new true class is also JSON::PP::Boolean";
54 ok $new_false->isa('JSON::PP::Boolean'), "new false class is also JSON::PP::Boolean";
58 ok $should_true->isa($true_class), "JSON true turns into a $true_class object";
[all …]
H A D099_binary.pl18 use JSON::PP;
24 $js = JSON::PP->new->allow_nonref(0)->utf8->ascii->shrink->encode ([$_[0]]);
26 $js = JSON::PP->new->allow_nonref(0)->utf8->ascii->encode ([$_[0]]);
27 ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0], " - 1");
29 $js = JSON::PP->new->allow_nonref(0)->utf8->shrink->encode ([$_[0]]);
31 $js = JSON::PP->new->allow_nonref(1)->utf8->encode ([$_[0]]);
32 ok ($_[0] eq (JSON::PP->new->utf8->shrink->decode($js))->[0], " - 3");
34 $js = JSON::PP->new->allow_nonref(1)->ascii->encode ([$_[0]]);
35 ok ($_[0] eq JSON::PP->new->decode ($js)->[0], " - 4");
36 $js = JSON::PP->new->allow_nonref(0)->ascii->encode ([$_[0]]);
[all …]
H A D001_utf8.t1 # copied over from JSON::XS and modified to use JSON::PP
11 use JSON::PP;
16 is (JSON::PP->new->allow_nonref (1)->utf8 (1)->encode ("¶"), "\"$pilcrow_utf8\"");
17 is (JSON::PP->new->allow_nonref (1)->encode ("¶"), "\"¶\"");
18 is (JSON::PP->new->allow_nonref (1)->ascii (1)->utf8 (1)->encode (chr 0x8000), '"\u8000"');
19 is (JSON::PP->new->allow_nonref (1)->ascii (1)->utf8 (1)->pretty (1)->encode (chr 0x10402), "\"\\ud…
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}"…
[all …]
H A Dcore_bools.t3 use JSON::PP;
6 # this is only for JSON.pm
8 unless JSON::PP->can('CORE_BOOL');
13 my $json = JSON::PP->new;
20 unless JSON::PP::CORE_BOOL;
62 unless JSON::PP::CORE_BOOL;
63 BEGIN { JSON::PP::CORE_BOOL and warnings->unimport(qw(experimental::builtin)) }
64 ok JSON::PP::is_bool($new_true), 'core true is a boolean';
65 ok JSON::PP::is_bool($new_false), 'core false is a boolean';
74 ok !ref $should_true && $should_true, "JSON true turns into an unblessed true value";
[all …]
H A D120_incr_parse_truncated.t4 use JSON::PP;
15 my $coder = JSON::PP->new;
25 my $coder = JSON::PP->new;
35 my $coder = JSON::PP->new;
45 my $coder = JSON::PP->new;
55 my $coder = JSON::PP->new;
65 my $coder = JSON::PP->new;
70 …like ($e, qr/malformed JSON string/, "'malformed JSON string' json string error for input='$input'…
75 my $coder = JSON::PP->new;
80 …like ($e, qr/malformed JSON string/, "'malformed JSON string' json string error for input='$input'…
[all …]
H A D020_faihu.t1 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
17 $js = JSON::PP->new->allow_nonref->ascii;
20 is ($roundtrip, $faihu, 'JSON in ASCII roundtrips correctly');
22 $js = JSON::PP->new->allow_nonref->utf8;
25 is ($roundtrip, $faihu, 'JSON in UTF-8 roundtrips correctly');
27 $js = JSON::PP->new->allow_nonref;
30 is ($roundtrip, $faihu, 'JSON with external recoding roundtrips correctly' );
H A D019_incr.t1 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
37 splitter +JSON::PP->new->allow_nonref (0), ' ["x\\"","\\u1000\\\\n\\nx",1,{"\\\\" :5 , "": "x"}]';
38 splitter +JSON::PP->new->allow_nonref (0), '[ "x\\"","\\u1000\\\\n\\nx" , 1,{"\\\\ " :5 , "": " x"}…
39 splitter +JSON::PP->new , '"test"';
40 splitter +JSON::PP->new , ' "5" ';
41 splitter +JSON::PP->new , '-1e5';
43 splitter +JSON::PP->new , ' 0.00E+00 ';
48 my $coder = JSON::PP->new;
72 my $coder = JSON::PP->new;
[all …]
H A D119_incr_parse_utf8.t6 use JSON::PP;
16 scalar eval { JSON::PP->new->allow_nonref (1)->utf8 (1)->incr_parse ('"ü"') };
19 ok (JSON::PP->new->allow_nonref (1)->incr_parse ('"ü"') eq "ü");
20 ok (JSON::PP->new->allow_nonref (1)->incr_parse ('"\u00fc"') eq "ü");
21 ok (JSON::PP->new->allow_nonref (1)->incr_parse ('"\ud801\udc02' . "\x{10204}\"") eq "\x{10402}\x{1…
22 ok (JSON::PP->new->allow_nonref (1)->incr_parse ('"\"\n\\\\\r\t\f\b"') eq "\"\012\\\015\011\014\010…
35 @vs = eval { JSON::PP->new->utf8->incr_parse( $JSON_TXT ) };
39 @vs = eval { JSON::PP->new->utf8->incr_parse( encode 'UTF-8' => $JSON_TXT ) };
52 @vs = eval { JSON::PP->new->utf8->incr_parse( encode 'UTF-8' => ( encode 'UTF-8' => $JSON_TXT ) ) };
67 @vs = eval { JSON::PP->new->incr_parse( $JSON_TXT ) };
H A D104_sortby.t7 use JSON::PP;
11 my $pc = JSON::PP->new;
19 $js = $pc->sort_by(sub { $JSON::PP::a cmp $JSON::PP::b })->encode($obj);
25 sub JSON::PP::hoge { $JSON::PP::a cmp $JSON::PP::b }
H A D010_pc_keysort.t1 # copied over from JSON::PC and modified to use JSON::PP
2 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
14 my $pc = JSON::PP->new->canonical(1);
H A D009_pc_extra_number.t1 # copied over from JSON::PC and modified to use JSON::PP
2 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
15 my $pc = JSON::PP->new;
H A D021_evans.t1 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
16 my $js = JSON::PP->new->encode ($data);
17 my $j = JSON::PP->new;
H A D005_dwiw_decode.t1 # copied over from JSON::XS and modified to use JSON::PP
3 # copied over from JSON::DWIW and modified to use JSON::PP
16 use JSON::PP;
20 my $json_obj = JSON::PP->new->allow_nonref(1);
H A D006_pc_pretty.t1 # copied over from JSON::PC and modified to use JSON::PP
2 # copied over from JSON::XS and modified to use JSON::PP
11 use JSON::PP;
14 my $pc = JSON::PP->new;
H A D008_pc_base.t3 # copied over from JSON::PC and modified to use JSON::PP
4 # copied over from JSON::XS and modified to use JSON::PP
11 use JSON::PP;
15 my $pc = JSON::PP->new;
90 like($@, qr/JSON can only/i, 'invalid value (coderef)');
94 #like($@, qr/JSON can only/i, 'invalid value (blessd object)');
H A D004_dwiw_encode.t1 # copied over from JSON::XS and modified to use JSON::PP
3 # copied over from JSON::DWIW and modified to use JSON::PP
16 use JSON::PP;
27 my $json_obj = JSON::PP->new->allow_nonref (1);
H A D011_pc_expo.t1 # copied over from JSON::PC and modified to use JSON::PP
2 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
14 my $pc = JSON::PP->new;
H A D015_prefix.t1 # copied over from JSON::XS and modified to use JSON::PP
10 use JSON::PP;
12 my $pp = JSON::PP->new->latin1->allow_nonref;
/openbsd-src/gnu/usr.bin/perl/cpan/CPAN-Meta-YAML/t/
H A D30_yaml_spec_tml.t10 my $JSON = json_class()
11 or Test::More::plan skip_all => 'no JSON backends available!?';
13 diag 'using JSON backend: ' . $JSON . ' ' . $JSON->VERSION
18 ['t/tml-spec/basic-data.tml', 'test_yaml_json', $JSON],
21 ['t/tml-spec/unicode.tml', 'test_code_point'], # uses JSON::PP
/openbsd-src/regress/lib/libcrypto/wycheproof/
H A Dwycheproof-json.pl18 use JSON::PP;
22 open JSON, "$test_vector_path/primality_test.json" or die;
23 @json = <JSON>;
24 close JSON;
26 $tv = JSON::PP::decode_json(join "\n", @json);
/openbsd-src/gnu/usr.bin/perl/cpan/CPAN-Meta-YAML/t/lib/
H A DTestUtils.pm30 …return eval { require JSON::MaybeXS; JSON::MaybeXS->VERSION('1.001000'); $JSON::MaybeXS::JSON_Clas…
31 || do { require JSON::PP; 'JSON::PP' };

1234567