File: 106_allow_barekey.t

package info (click to toggle)
libcpanel-json-xs-perl 4.09-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,776 kB
  • sloc: perl: 1,052; makefile: 8
file content (16 lines) | stat: -rw-r--r-- 418 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

use Test::More tests => 4;
use strict;
use Cpanel::JSON::XS;
#########################

my $json = Cpanel::JSON::XS->new;

eval q| $json->decode('{foo:"bar"}') |;
ok($@); # in XS and PP, the error message differs.

$json->allow_barekey;
is($json->decode('{foo:"bar"}')->{foo}, 'bar');
is($json->decode('{ foo : "bar"}')->{foo}, 'bar', 'with space');
is($json->decode(qq({\tfoo\t:"bar"}))->{foo}, 'bar', 'with tab');