1use Test::More;
2use strict;
3BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
4BEGIN { $ENV{PERL_JSON_PP_USE_B} = 0 }
5use JSON::PP;
6
7#SKIP_ALL_UNLESS_PP 2.90
8#SKIP_ALL_IF_XS
9
10BEGIN { plan tests => 3 }
11
12# TODO ("inf"/"nan" representations are not portable)
13# is encode_json([9**9**9]), '["inf"]';
14# is encode_json([-sin(9**9**9)]), '["nan"]';
15
16my $num = 3;
17my $str = "$num";
18is encode_json({test => [$num, $str]}), '{"test":[3,"3"]}';
19$num = 3.21;
20$str = "$num";
21is encode_json({test => [$num, $str]}), '{"test":[3.21,"3.21"]}';
22$str = '0 but true';
23$num = 1 + $str;
24is encode_json({test => [$num, $str]}), '{"test":[1,"0 but true"]}';
25