Skip to content

Commit

Permalink
more tests for special JSON characters
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 8, 2013
1 parent 76bcb80 commit ba1773e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,4 +1,7 @@

4.56 2013-11-09
- Fixed backspace escaping bug in Mojo::JSON. (ig3)

4.55 2013-11-07
- Fixed Windows bug in "daemon.t".

Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious.pm
Expand Up @@ -803,6 +803,8 @@ Henry Tang
Hideki Yamamura
Ian Goodacre
Ilya Chesnokov
James Duncan
Expand Down
8 changes: 4 additions & 4 deletions t/mojo/json.t
Expand Up @@ -70,8 +70,8 @@ $array = $json->decode('[" 0"]');
is_deeply $array, [' 0'], 'decode [" 0"]';
$array = $json->decode('["1"]');
is_deeply $array, ['1'], 'decode ["1"]';
$array = $json->decode('["\u0007\b"]');
is_deeply $array, ["\a\b"], 'decode ["\u0007\b"]';
$array = $json->decode('["\u0007\b\/\f\r"]');
is_deeply $array, ["\a\b/\f\r"], 'decode ["\u0007\b\/\f\r"]';

# Decode object
my $hash = $json->decode('{}');
Expand Down Expand Up @@ -131,8 +131,8 @@ is b($bytes)->decode('UTF-8'), "[\"hello\\u0003\x{0152}world\x{0152}!\"]",
'encode ["hello\x{0003}\x{0152}world\x{0152}!"]';
$bytes = $json->encode(["123abc"]);
is $bytes, '["123abc"]', 'encode ["123abc"]';
$bytes = $json->encode(["\a\b"]);
is $bytes, '["\\u0007\\b"]', 'encode ["\a\b"]';
$bytes = $json->encode(["\a\b/\f\r"]);
is $bytes, '["\\u0007\\b\/\f\r"]', 'encode ["\a\b/\f\r"]';

# Encode object
$bytes = $json->encode({});
Expand Down

0 comments on commit ba1773e

Please sign in to comment.