Skip to content

Commit

Permalink
added tests for encoding the same data twice with Mojo::JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 11, 2014
1 parent 269f65a commit 330e659
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions t/mojo/json.t
Expand Up @@ -307,6 +307,14 @@ $num = 1 + $str;
is $json->encode({test => [$num, $str]}), '{"test":[1,0]}',
'upgraded number detected';

# Ensure numbers and strings are not upgraded
$num = 3;
$str = "three";
is $json->encode([$num, $str]), '[3,"three"]',
'both have been detected correctly';
is $json->encode([$num, $str]), '[3,"three"]',
'both have been detected correctly again';

# "inf" and "nan"
like $json->encode({test => 9**9**9}), qr/^{"test":".*"}$/,
'encode "inf" as string';
Expand Down

0 comments on commit 330e659

Please sign in to comment.