File: 98_56only.t

package info (click to toggle)
libcpanel-json-xs-perl 4.39-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,872 kB
  • sloc: perl: 1,165; makefile: 8
file content (36 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use Test::More tests => 4;
# $] < 5.008 ? (tests => 4) : (skip_all => "5.6 only");
use Cpanel::JSON::XS;

{
    my $formref = {
        'cpanel_apiversion' => 1,
        'utf8'       => 'אאאאאאאխ"',
        'func'       => 'phpmyadminlink',
        'module'     => 'Cgi',
        "включен"    => "日本語"
    };

    ok( decode_json( encode_json($formref) ),
	"Cpanel::JSON::XS :: round trip untied utf8 with int" );
}

{
    my $formref = {
        'cpanel_apiversion' => 1,
        'utf8'       => 'română',
        'func'       => 'phpmyadminlink',
        'module'     => 'Cgi',
        "включен"    => "日本語"
    };

    ok( decode_json( encode_json($formref) ),
        "JSON::XS :: round trip utf8 complex" );
}

my $json = Cpanel::JSON::XS->new;
$js  = q|[-12.34]|;
$obj = $json->decode($js);
is($obj->[0], -12.34, 'digit -12.34');
$js = $json->encode($obj);
is($js,'[-12.34]', 'digit -12.34');