@@ -26,7 +26,7 @@ const utf16le = [ 0x7A, 0x00, 0xA2, 0x00, 0x34, 0x6C, 0x34, 0xD8, 0x1E, 0xDD, 0x
2626const utf16beBOM = [ 0xfe , 0xff ] ;
2727const utf16be = [ 0x00 , 0x7A , 0x00 , 0xA2 , 0x6C , 0x34 , 0xD8 , 0x34 , 0xDD , 0x1E , 0xDB , 0xFF , 0xDF , 0xFD ] ;
2828
29- // z, cent, CJK water, G-Clef, Private-use character
29+ // Parts: z, cent, CJK water, G-Clef, Private-use character
3030const utfSample = "z\xA2\u6C34\uD834\uDD1E\uDBFF\uDFFD" ;
3131
3232const UTF8_ENCODING = [ "utf-8" ] ;
@@ -72,20 +72,20 @@ describe("TextDecoder", () => {
7272 } ) ;
7373 it ( "throws exception on bad input when fatal flag is true" , ( ) => {
7474 const badInputs = [
75- { encoding : "utf-8" , input : [ 0xC0 ] } , // ends early
76- { encoding : "utf-8" , input : [ 0xC0 , 0x00 ] } , // invalid trail
77- { encoding : "utf-8" , input : [ 0xC0 , 0xC0 ] } , // invalid trail
78- { encoding : "utf-8" , input : [ 0xE0 ] } , // ends early
79- { encoding : "utf-8" , input : [ 0xE0 , 0x00 ] } , // invalid trail
80- { encoding : "utf-8" , input : [ 0xE0 , 0xC0 ] } , // invalid trail
81- { encoding : "utf-8" , input : [ 0xE0 , 0x80 , 0x00 ] } , // invalid trail
82- { encoding : "utf-8" , input : [ 0xE0 , 0x80 , 0xC0 ] } , // invalid trail
75+ { encoding : "utf-8" , input : [ 0xC0 ] } , // Ends early
76+ { encoding : "utf-8" , input : [ 0xC0 , 0x00 ] } , // Invalid trail
77+ { encoding : "utf-8" , input : [ 0xC0 , 0xC0 ] } , // Invalid trail
78+ { encoding : "utf-8" , input : [ 0xE0 ] } , // Ends early
79+ { encoding : "utf-8" , input : [ 0xE0 , 0x00 ] } , // Invalid trail
80+ { encoding : "utf-8" , input : [ 0xE0 , 0xC0 ] } , // Invalid trail
81+ { encoding : "utf-8" , input : [ 0xE0 , 0x80 , 0x00 ] } , // Invalid trail
82+ { encoding : "utf-8" , input : [ 0xE0 , 0x80 , 0xC0 ] } , // Invalid trail
8383 { encoding : "utf-8" , input : [ 0xFC , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 ] } , // > 0x10FFFF
84- { encoding : "utf-16le" , input : [ 0x00 ] } , // truncated code unit
85- { encoding : "utf-16le" , input : [ 0x00 , 0xd8 ] } , // surrogate half
86- { encoding : "utf-16le" , input : [ 0x00 , 0xd8 , 0x00 , 0x00 ] } , // surrogate half
87- { encoding : "utf-16le" , input : [ 0x00 , 0xdc , 0x00 , 0x00 ] } , // trail surrogate
88- { encoding : "utf-16le" , input : [ 0x00 , 0xdc , 0x00 , 0xd8 ] } // swapped surrogates
84+ { encoding : "utf-16le" , input : [ 0x00 ] } , // Truncated code unit
85+ { encoding : "utf-16le" , input : [ 0x00 , 0xd8 ] } , // Surrogate half
86+ { encoding : "utf-16le" , input : [ 0x00 , 0xd8 , 0x00 , 0x00 ] } , // Surrogate half
87+ { encoding : "utf-16le" , input : [ 0x00 , 0xdc , 0x00 , 0x00 ] } , // Trail surrogate
88+ { encoding : "utf-16le" , input : [ 0x00 , 0xdc , 0x00 , 0xd8 ] } // Swapped surrogates
8989 ] ;
9090 for ( const badInput of badInputs ) {
9191 const encoded = new Uint8Array ( badInput . input ) ;
0 commit comments