Index: LayoutTests/fast/encoding/api/surrogate-pairs.html |
diff --git a/LayoutTests/fast/encoding/api/surrogate-pairs.html b/LayoutTests/fast/encoding/api/surrogate-pairs.html |
index 8be62c4076cc67cbdb6b9308f5a080a8bc27fcf0..dc35210026070d29f3280d3f855e1e2bff041a6e 100644 |
--- a/LayoutTests/fast/encoding/api/surrogate-pairs.html |
+++ b/LayoutTests/fast/encoding/api/surrogate-pairs.html |
@@ -5,19 +5,18 @@ |
description("Test invalid UTF-16 surrogate pairs with UTF-8 encoding"); |
var badStrings = [ |
- { input: 'abc123', expected: 'abc123' }, // Sanity check. |
- { input: '\ud800', expected: '\ufffd' }, // Surrogate half. |
- { input: '\udc00', expected: '\ufffd' }, // Surrogate half. |
- { input: 'abc\ud800def', expected: 'abc\ufffddef' }, // Surrogate half. |
- { input: 'abc\udc00def', expected: 'abc\ufffddef' }, // Surrogate half. |
- { input: '\udc00\ud800', expected: '\ufffd\ufffd' } // Wrong order. |
+ { input: "'abc123'", expected: [97, 98, 99, 49, 50, 51] }, // Sanity check. |
+ { input: "'\\ud800'", expected: [0xef, 0xbf, 0xbd] }, // Surrogate half. |
+ { input: "'\\udc00'", expected: [0xef, 0xbf, 0xbd] }, // Surrogate half. |
+ { input: "'abc\\ud800123'", expected: [0x61, 0x62, 0x63, 0xef, 0xbf, 0xbd, 0x31, 0x32, 0x33] }, // Surrogate half. |
+ { input: "'abc\\udc00123'", expected: [0x61, 0x62, 0x63, 0xef, 0xbf, 0xbd, 0x31, 0x32, 0x33] }, // Surrogate half. |
+ { input: "'\\udc00\\ud800'", expected: [239, 191, 189, 239, 191, 189] } // Wrong order. |
]; |
badStrings.forEach( |
function(t) { |
- evalAndLog("encoded = new TextEncoder('utf-8').encode(" + JSON.stringify(t.input) + ")"); |
- evalAndLog("decoded = new TextDecoder('utf-8').decode(encoded)"); |
- shouldBeEqualToString("decoded", t.expected); |
+ evalAndLog("encoded = new TextEncoder('utf-8').encode(" + t.input + ")"); |
+ shouldBeEqualToString("JSON.stringify([].slice.call(encoded))", JSON.stringify(t.expected)); |
debug(""); |
}); |