summaryrefslogtreecommitdiff
path: root/t/rt_116998_wrong_character_offset.t
blob: 8b9c0c5ca2d1c3a7d8cbe8acbf38cde925dac78d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use Test::More;
BEGIN { plan tests => 4 };
BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
use JSON;

SKIP: { skip "requires $JSON::BackendModule 2.90 or newer", 1 if $JSON::BackendModulePP and eval $JSON::BackendModulePP->VERSION < 2.90;
eval { decode_json(qq({"foo":{"bar":42})) };
like $@ => qr/offset 17/; # 16
}

eval { decode_json(qq(["foo",{"bar":42})) };
like $@ => qr/offset 17/;

SKIP: { skip "requires $JSON::BackendModule 2.90 or newer", 1 if $JSON::BackendModulePP and eval $JSON::BackendModulePP->VERSION < 2.90;
eval { decode_json(qq(["foo",{"bar":42}"])) };
like $@ => qr/offset 17/; # 18
}

eval { decode_json(qq({"foo":{"bar":42}"})) };
like $@ => qr/offset 17/;