| OLD | NEW |
| 1 Edge cases around non-fatal errors at EOF | 1 This is a testharness.js-based test. |
| 2 PASS Fatal flag, non-streaming cases |
| 3 PASS Fatal flag, streaming cases |
| 4 Harness: the test ran to completion. |
| 2 | 5 |
| 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
| 4 | |
| 5 | |
| 6 PASS new TextDecoder('utf-8', {fatal: true}).decode(new Uint8Array([0xff])) thre
w exception EncodingError: Failed to execute 'decode' on 'TextDecoder': The enco
ded data was not valid.. | |
| 7 | |
| 8 PASS new TextDecoder('utf-8').decode(new Uint8Array([0xff])) is '�' | |
| 9 | |
| 10 PASS new TextDecoder('utf-16le', {fatal: true}).decode(new Uint8Array([0x00])) t
hrew exception EncodingError: Failed to execute 'decode' on 'TextDecoder': The e
ncoded data was not valid.. | |
| 11 | |
| 12 PASS new TextDecoder('utf-16le').decode(new Uint8Array([0x00])) is '�' | |
| 13 | |
| 14 PASS new TextDecoder('utf-16be', {fatal: true}).decode(new Uint8Array([0x00])) t
hrew exception EncodingError: Failed to execute 'decode' on 'TextDecoder': The e
ncoded data was not valid.. | |
| 15 | |
| 16 PASS new TextDecoder('utf-16be').decode(new Uint8Array([0x00])) is '�' | |
| 17 | |
| 18 Streaming cases: | |
| 19 decoder = new TextDecoder('utf-16le', {fatal: true}) | |
| 20 odd = new Uint8Array([0x00]) | |
| 21 even = new Uint8Array([0x00, 0x00]) | |
| 22 | |
| 23 PASS decoder.decode(odd, {stream: true}); decoder.decode(odd) did not throw exce
ption. | |
| 24 PASS decoder.decode(even, {stream: true}); decoder.decode(odd) threw exception E
ncodingError: Failed to execute 'decode' on 'TextDecoder': The encoded data was
not valid.. | |
| 25 PASS decoder.decode(odd, {stream: true}); decoder.decode(even) threw exception E
ncodingError: Failed to execute 'decode' on 'TextDecoder': The encoded data was
not valid.. | |
| 26 PASS decoder.decode(even, {stream: true}); decoder.decode(even) did not throw ex
ception. | |
| 27 PASS successfullyParsed is true | |
| 28 | |
| 29 TEST COMPLETE | |
| 30 | |
| OLD | NEW |