Browse Source

More UTF-16 test cases by John.

Gustavo Niemeyer 10 years ago
parent
commit
f7716cbe52
1 changed files with 12 additions and 2 deletions
  1. 12 2
      decode_test.go

+ 12 - 2
decode_test.go

@@ -563,13 +563,23 @@ var unmarshalTests = []struct {
 	// UTF-16-LE
 	{
 		"\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n\x00",
-		M{"ñoño":"very yes"},
+		M{"ñoño": "very yes"},
+	},
+	// UTF-16-LE with surrogate.
+	{
+		"\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \x00=\xd8\xd4\xdf\n\x00",
+		M{"ñoño": "very yes 🟔"},
 	},
 
 	// UTF-16-BE
 	{
 		"\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n",
-		M{"ñoño":"very yes"},
+		M{"ñoño": "very yes"},
+	},
+	// UTF-16-BE with surrogate.
+	{
+		"\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \xd8=\xdf\xd4\x00\n",
+		M{"ñoño": "very yes 🟔"},
 	},
 }