Permalink
Browse files

bring back test for surrogate pair

  • Loading branch information...
1 parent ad3722b commit bd94b593b3a0f2d5595fa74bce5371abe66c9b37 @kraih committed Mar 3, 2014
Showing with 4 additions and 3 deletions.
  1. +0 −3 lib/Mojo/JSON.pm
  2. +4 −0 t/mojo/json.t
View
@@ -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();
View
@@ -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}';

0 comments on commit bd94b59

Please sign in to comment.