Skip to content

Commit

Permalink
bring back test for surrogate pair
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 3, 2014
1 parent ad3722b commit bd94b59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/Mojo/JSON.pm
Expand Up @@ -72,9 +72,6 @@ sub _decode {
die "Input is not UTF-8 encoded\n"
unless defined(local $_ = Mojo::Util::decode('UTF-8', $bytes));

# Leading whitespace
m/\G$WHITESPACE_RE/gc;

# Value
my $value = _decode_value();

Expand Down
4 changes: 4 additions & 0 deletions t/mojo/json.t
Expand Up @@ -208,6 +208,10 @@ is b($bytes)->decode('UTF-8'), "[\"\x{10346}\"]", 'encode ["\x{10346}"]';
$array = j($bytes);
is_deeply $array, ["\x{10346}"], 'successful roundtrip';

# Decode faihu surrogate pair
$array = $json->decode('["\\ud800\\udf46"]');
is_deeply $array, ["\x{10346}"], 'decode [\"\\ud800\\udf46\"]';

# Decode object with duplicate keys
$hash = $json->decode('{"foo": 1, "foo": 2}');
is_deeply $hash, {foo => 2}, 'decode {"foo": 1, "foo": 2}';
Expand Down

0 comments on commit bd94b59

Please sign in to comment.