"Fossies" - the Fresh Open Source Software Archive

Member "perl-5.32.1/cpan/JSON-PP/t/010_pc_keysort.t" (18 Dec 2020, 464 Bytes) of package /linux/misc/perl-5.32.1.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # copied over from JSON::PC and modified to use JSON::PP
    2 # copied over from JSON::XS and modified to use JSON::PP
    3 
    4 use Test::More;
    5 use strict;
    6 BEGIN { plan tests => 1 };
    7 BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
    8 
    9 use JSON::PP;
   10 #########################
   11 
   12 my ($js,$obj);
   13 my $pc = JSON::PP->new->canonical(1);
   14 
   15 $obj = {a=>1, b=>2, c=>3, d=>4, e=>5, f=>6, g=>7, h=>8, i=>9};
   16 
   17 $js = $pc->encode($obj);
   18 is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|);
   19