| Index: LayoutTests/fast/encoding/api/ascii-supersets.html
|
| diff --git a/LayoutTests/fast/encoding/api/ascii-supersets.html b/LayoutTests/fast/encoding/api/ascii-supersets.html
|
| index d336c0da10dee2edeea7495957ff2c0ee427f615..15bdbe9934246e29f21ecb817d9016fd6c7a64af 100644
|
| --- a/LayoutTests/fast/encoding/api/ascii-supersets.html
|
| +++ b/LayoutTests/fast/encoding/api/ascii-supersets.html
|
| @@ -1,43 +1,39 @@
|
| <!DOCTYPE html>
|
| -<script src="../../../resources/js-test.js"></script>
|
| +<title>Encoding API: ASCII supersets</title>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| <script src="resources/shared.js"></script>
|
| <script>
|
|
|
| -description("Supersets of ASCII decode ASCII correctly");
|
| -
|
| // Encodings that have escape codes in 0x00-0x7F
|
| var escape_codes = {
|
| - "hz-gb-2312": [ 0x7E ],
|
| - "iso-2022-jp": [ 0x1B ],
|
| - "iso-2022-kr": [ 0x0E, 0x0F, 0x1B ]
|
| + 'hz-gb-2312': [ 0x7E ],
|
| + 'iso-2022-jp': [ 0x1B ],
|
| + 'iso-2022-kr': [ 0x0E, 0x0F, 0x1B ]
|
| };
|
|
|
| encodings_table.forEach(function(section) {
|
| section.encodings.forEach(function(encoding) {
|
| - if (encoding.name === "replacement")
|
| + if (encoding.name === 'replacement')
|
| return;
|
| if (utf_encodings.indexOf(encoding.name) !== -1)
|
| return;
|
|
|
| - string = '';
|
| - decoded = null;
|
| - bytes = [];
|
| - for (var i = 0; i < 128; ++i) {
|
| - if (encoding.name in escape_codes && escape_codes[encoding.name].indexOf(i) !== -1)
|
| - continue;
|
| - string += String.fromCharCode(i);
|
| - bytes.push(i);
|
| - }
|
| + test(function() {
|
| + var string = '';
|
| + var bytes = [];
|
| + for (var i = 0; i < 128; ++i) {
|
| + if (encoding.name in escape_codes && escape_codes[encoding.name].indexOf(i) !== -1)
|
| + continue;
|
| + string += String.fromCharCode(i);
|
| + bytes.push(i);
|
| + }
|
|
|
| - decoder = null;
|
| - evalAndLog("decoder = new TextDecoder(" + JSON.stringify(encoding.name) + ")");
|
| - if (decoder) {
|
| - evalAndLog("decoded = decoder.decode(new Uint8Array(bytes))");
|
| - // encodeURIComponent ensures output is printable
|
| - shouldBe("encodeURIComponent(string)", "encodeURIComponent(decoded)");
|
| - }
|
| + var decoder = new TextDecoder(encoding.name);
|
| + var decoded = decoder.decode(new Uint8Array(bytes));
|
| + assert_equals(decoded, string);
|
| + }, 'ASCII superset encoding: ' + encoding.name);
|
| });
|
| });
|
|
|
| -
|
| </script>
|
|
|