Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: LayoutTests/fast/encoding/api/surrogate-pairs.html

Issue 240283013: Convert Encoding API tests to W3C testharness.js (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move UTF-16 surrogate tests to separate file Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <script>
4
5 description("Test invalid UTF-16 surrogate pairs with UTF-8 encoding");
6
7 var badStrings = [
8 { input: "'abc123'", expected: [97, 98, 99, 49, 50, 51] }, // Sanity check.
9 { input: "'\\ud800'", expected: [0xef, 0xbf, 0xbd] }, // Surrogate half.
10 { input: "'\\udc00'", expected: [0xef, 0xbf, 0xbd] }, // Surrogate half.
11 { input: "'abc\\ud800123'", expected: [0x61, 0x62, 0x63, 0xef, 0xbf, 0xbd, 0 x31, 0x32, 0x33] }, // Surrogate half.
12 { input: "'abc\\udc00123'", expected: [0x61, 0x62, 0x63, 0xef, 0xbf, 0xbd, 0 x31, 0x32, 0x33] }, // Surrogate half.
13 { input: "'\\udc00\\ud800'", expected: [239, 191, 189, 239, 191, 189] } // Wrong order.
14 ];
15
16 badStrings.forEach(
17 function(t) {
18 evalAndLog("encoded = new TextEncoder('utf-8').encode(" + t.input + ")") ;
19 shouldBeEqualToString("JSON.stringify([].slice.call(encoded))", JSON.str ingify(t.expected));
20 debug("");
21 });
22
23 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698