Skip to content

Commit

Permalink
made Mojo::JSON tests a little harder
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 11, 2014
1 parent 330e659 commit fa1b2d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions t/mojo/json.t
Expand Up @@ -308,12 +308,11 @@ 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';
my @values = (3, 'three', '3');
is $json->encode(\@values), '[3,"three","3"]',
'all have been detected correctly';
is $json->encode(\@values), '[3,"three","3"]',
'all have been detected correctly again';

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

0 comments on commit fa1b2d1

Please sign in to comment.