diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-31 22:05:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-31 22:05:31 (GMT) |
commit | 4f5c603784f1edcf014c802f68d84f7e98c55efe (patch) | |
tree | 2db018efad87ed328d3da116c78d3bae2fdf7b6b /tests | |
parent | b6a444f634fe88af76fd43b8cb7a05df44c5f246 (diff) | |
parent | 0758324455f7cd805291c1062b6c7fb70fd13647 (diff) | |
download | tcl-4f5c603784f1edcf014c802f68d84f7e98c55efe.zip tcl-4f5c603784f1edcf014c802f68d84f7e98c55efe.tar.gz tcl-4f5c603784f1edcf014c802f68d84f7e98c55efe.tar.bz2 |
Rebase to 9.0
Diffstat (limited to 'tests')
-rw-r--r-- | tests/chanio.test | 2 | ||||
-rw-r--r-- | tests/encoding.test | 160 | ||||
-rw-r--r-- | tests/encodingVectors.tcl | 2 | ||||
-rw-r--r-- | tests/io.test | 56 | ||||
-rw-r--r-- | tests/ioCmd.test | 8 | ||||
-rw-r--r-- | tests/utfext.test | 2 | ||||
-rw-r--r-- | tests/winConsole.test | 2 | ||||
-rw-r--r-- | tests/zlib.test | 4 |
8 files changed, 119 insertions, 117 deletions
diff --git a/tests/chanio.test b/tests/chanio.test index 09e71ca..d2d96d1 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -1098,7 +1098,7 @@ test chan-io-7.3 {FilterInputBytes: split up character at EOF} -setup { chan puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" chan close $f set f [open $path(test1)] - chan configure $f -encoding shiftjis + chan configure $f -encoding shiftjis -profile tcl8 lappend x [chan gets $f line] $line lappend x [chan tell $f] [testchannel inputbuffered $f] [chan eof $f] lappend x [chan gets $f line] $line diff --git a/tests/encoding.test b/tests/encoding.test index 35340a6..0d8fdfe 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -465,22 +465,22 @@ test encoding-15.25 {UtfToUtfProc CESU-8} { encoding convertfrom cesu-8 \x00 } \x00 test encoding-15.26 {UtfToUtfProc CESU-8} { - encoding convertfrom cesu-8 \xC0\x80 + encoding convertfrom -profile tcl8 cesu-8 \xC0\x80 } \x00 -test encoding-15.27 {UtfToUtfProc -profile strict CESU-8} { - encoding convertfrom -profile strict cesu-8 \x00 +test encoding-15.27 {UtfToUtfProc CESU-8} { + encoding convertfrom cesu-8 \x00 } \x00 -test encoding-15.28 {UtfToUtfProc -profile strict CESU-8} -body { - encoding convertfrom -profile strict cesu-8 \xC0\x80 +test encoding-15.28 {UtfToUtfProc CESU-8} -body { + encoding convertfrom cesu-8 \xC0\x80 } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xC0'} test encoding-15.29 {UtfToUtfProc CESU-8} { encoding convertto cesu-8 \x00 } \x00 -test encoding-15.30 {UtfToUtfProc -profile strict CESU-8} { - encoding convertto -profile strict cesu-8 \x00 +test encoding-15.30 {UtfToUtfProc CESU-8} { + encoding convertto cesu-8 \x00 } \x00 -test encoding-15.31 {UtfToUtfProc -profile strict CESU-8 (bytes F0-F4 are invalid)} -body { - encoding convertfrom -profile strict cesu-8 \xF1\x86\x83\x9C +test encoding-15.31 {UtfToUtfProc CESU-8 (bytes F0-F4 are invalid)} -body { + encoding convertfrom cesu-8 \xF1\x86\x83\x9C } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xF1'} test encoding-16.1 {Utf16ToUtfProc} -body { @@ -492,7 +492,7 @@ test encoding-16.2 {Utf16ToUtfProc} -body { list $val [format %x [scan $val %c]] } -result "\U460DC 460dc" test encoding-16.3 {Utf16ToUtfProc} -body { - set val [encoding convertfrom utf-16 "\xDC\xDC"] + set val [encoding convertfrom -profile tcl8 utf-16 "\xDC\xDC"] list $val [format %x [scan $val %c]] } -result "\uDCDC dcdc" test encoding-16.4 {Ucs2ToUtfProc} -body { @@ -516,31 +516,31 @@ test encoding-16.8 {Utf32ToUtfProc} -body { list $val [format %x [scan $val %c]] } -result "\uFFFD fffd" test encoding-16.9 {Utf32ToUtfProc} -constraints utf32 -body { - encoding convertfrom utf-32le \x00\xD8\x00\x00 + encoding convertfrom -profile tcl8 utf-32le \x00\xD8\x00\x00 } -result \uD800 test encoding-16.10 {Utf32ToUtfProc} -body { - encoding convertfrom utf-32le \x00\xDC\x00\x00 + encoding convertfrom -profile tcl8 utf-32le \x00\xDC\x00\x00 } -result \uDC00 test encoding-16.11 {Utf32ToUtfProc} -body { - encoding convertfrom utf-32le \x00\xD8\x00\x00\x00\xDC\x00\x00 + encoding convertfrom -profile tcl8 utf-32le \x00\xD8\x00\x00\x00\xDC\x00\x00 } -result \uD800\uDC00 test encoding-16.12 {Utf32ToUtfProc} -constraints utf32 -body { - encoding convertfrom utf-32le \x00\xDC\x00\x00\x00\xD8\x00\x00 + encoding convertfrom -profile tcl8 utf-32le \x00\xDC\x00\x00\x00\xD8\x00\x00 } -result \uDC00\uD800 test encoding-16.13 {Utf16ToUtfProc} -body { - encoding convertfrom utf-16le \x00\xD8 + encoding convertfrom -profile tcl8 utf-16le \x00\xD8 } -result \uD800 test encoding-16.14 {Utf16ToUtfProc} -body { - encoding convertfrom utf-16le \x00\xDC + encoding convertfrom -profile tcl8 utf-16le \x00\xDC } -result \uDC00 test encoding-16.15 {Utf16ToUtfProc} -body { encoding convertfrom utf-16le \x00\xD8\x00\xDC } -result \U010000 test encoding-16.16 {Utf16ToUtfProc} -body { - encoding convertfrom utf-16le \x00\xDC\x00\xD8 + encoding convertfrom -profile tcl8 utf-16le \x00\xDC\x00\xD8 } -result \uDC00\uD800 test encoding-16.17 {Utf32ToUtfProc} -body { - list [encoding convertfrom -profile strict -failindex idx utf-32le \x41\x00\x00\x00\x00\xD8\x00\x00\x42\x00\x00\x00] [set idx] + list [encoding convertfrom -failindex idx utf-32le \x41\x00\x00\x00\x00\xD8\x00\x00\x42\x00\x00\x00] [set idx] } -result {A 4} test encoding-16.18 { @@ -563,25 +563,25 @@ test encoding-16.18 { } [namespace current]] } -result done test encoding-16.19 {Utf16ToUtfProc, bug [d19fe0a5b]} -body { - encoding convertfrom utf-16 "\x41\x41\x41" + encoding convertfrom -profile tcl8 utf-16 "\x41\x41\x41" } -result \u4141\uFFFD -test encoding-16.20 {Utf16ToUtfProc, bug [d19fe0a5b]} -constraints deprecated -body { - encoding convertfrom utf-16 "\xD8\xD8" +test encoding-16.20 {UnicodeToUtfProc, bug [d19fe0a5b]} -body { + encoding convertfrom -profile tcl8 utf-16 "\xD8\xD8" } -result \uD8D8 test encoding-16.21 {Utf16ToUtfProc, bug [d19fe0a5b]} -body { - encoding convertfrom utf-32 "\x00\x00\x00\x00\x41\x41" + encoding convertfrom -profile tcl8 utf-32 "\x00\x00\x00\x00\x41\x41" } -result \x00\uFFFD test encoding-16.22 {Utf16ToUtfProc, strict, bug [db7a085bd9]} -body { - encoding convertfrom -profile strict utf-16le \x00\xD8 + encoding convertfrom utf-16le \x00\xD8 } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\x00'} test encoding-16.23 {Utf16ToUtfProc, strict, bug [db7a085bd9]} -body { - encoding convertfrom -profile strict utf-16le \x00\xDC + encoding convertfrom utf-16le \x00\xDC } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\x00'} test encoding-16.24 {Utf32ToUtfProc} -body { - encoding convertfrom utf-32 "\xFF\xFF\xFF\xFF" + encoding convertfrom -profile tcl8 utf-32 "\xFF\xFF\xFF\xFF" } -result \uFFFD test encoding-16.25 {Utf32ToUtfProc} -body { - encoding convertfrom utf-32 "\x01\x00\x00\x01" + encoding convertfrom -profile tcl8 utf-32 "\x01\x00\x00\x01" } -result \uFFFD test encoding-17.1 {UtfToUtf16Proc} -body { @@ -603,60 +603,60 @@ test encoding-17.6 {UtfToUtf16Proc} -body { encoding convertto utf-32be "\U460DC" } -result "\x00\x04\x60\xDC" test encoding-17.7 {UtfToUtf16Proc} -body { - encoding convertto -profile strict utf-16be "\uDCDC" + encoding convertto utf-16be "\uDCDC" } -returnCodes error -result {unexpected character at index 0: 'U+00DCDC'} test encoding-17.8 {UtfToUtf16Proc} -body { - encoding convertto -profile strict utf-16le "\uD8D8" + encoding convertto utf-16le "\uD8D8" } -returnCodes error -result {unexpected character at index 0: 'U+00D8D8'} test encoding-17.9 {Utf32ToUtfProc} -body { - encoding convertfrom -profile strict utf-32 "\xFF\xFF\xFF\xFF" + encoding convertfrom utf-32 "\xFF\xFF\xFF\xFF" } -returnCodes error -result {unexpected byte sequence starting at index 0: '\xFF'} test encoding-17.10 {Utf32ToUtfProc} -body { encoding convertfrom -profile tcl8 utf-32 "\xFF\xFF\xFF\xFF" } -result \uFFFD test encoding-17.11 {Utf32ToUtfProc} -body { - encoding convertfrom -profile strict utf-32le "\x00\xD8\x00\x00" + encoding convertfrom utf-32le "\x00\xD8\x00\x00" } -returnCodes error -result {unexpected byte sequence starting at index 0: '\x00'} test encoding-17.12 {Utf32ToUtfProc} -body { - encoding convertfrom -profile strict utf-32le "\x00\xDC\x00\x00" + encoding convertfrom utf-32le "\x00\xDC\x00\x00" } -returnCodes error -result {unexpected byte sequence starting at index 0: '\x00'} test encoding-18.1 {TableToUtfProc on invalid input} -body { list [catch {encoding convertto jis0208 \\} res] $res -} -result {0 !)} -test encoding-18.2 {TableToUtfProc on invalid input with -profile strict} -body { - list [catch {encoding convertto -profile strict jis0208 \\} res] $res } -result {1 {unexpected character at index 0: 'U+00005C'}} -test encoding-18.3 {TableToUtfProc on invalid input with -profile strict -failindex} -body { - list [catch {encoding convertto -profile strict -failindex pos jis0208 \\} res] $res $pos +test encoding-18.2 {TableToUtfProc on invalid input with} -body { + list [catch {encoding convertto jis0208 \\} res] $res +} -result {1 {unexpected character at index 0: 'U+00005C'}} +test encoding-18.3 {TableToUtfProc on invalid input with -failindex} -body { + list [catch {encoding convertto -failindex pos jis0208 \\} res] $res $pos } -result {0 {} 0} -test encoding-18.4 {TableToUtfProc on invalid input with -failindex -profile strict} -body { - list [catch {encoding convertto -failindex pos -profile strict jis0208 \\} res] $res $pos +test encoding-18.4 {TableToUtfProc on invalid input with -failindex} -body { + list [catch {encoding convertto -failindex pos jis0208 \\} res] $res $pos } -result {0 {} 0} test encoding-18.5 {TableToUtfProc on invalid input with -failindex} -body { list [catch {encoding convertto -failindex pos jis0208 \\} res] $res $pos -} -result {0 !) -1} +} -result {0 {} 0} test encoding-18.6 {TableToUtfProc on invalid input with -profile tcl8} -body { list [catch {encoding convertto -profile tcl8 jis0208 \\} res] $res } -result {0 !)} test encoding-19.1 {TableFromUtfProc} -body { - encoding convertfrom ascii AÁ + encoding convertfrom -profile tcl8 ascii AÁ } -result AÁ test encoding-19.2 {TableFromUtfProc} -body { encoding convertfrom -profile tcl8 ascii AÁ } -result AÁ test encoding-19.3 {TableFromUtfProc} -body { - encoding convertfrom -profile strict ascii AÁ + encoding convertfrom ascii AÁ } -returnCodes 1 -result {unexpected byte sequence starting at index 1: '\xC1'} test encoding-19.4 {TableFromUtfProc} -body { list [encoding convertfrom -failindex idx ascii AÁ] [set idx] -} -result [list A\xC1 -1] +} -result {A 1} test encoding-19.5 {TableFromUtfProc} -body { - list [encoding convertfrom -failindex idx -profile strict ascii A\xC1] [set idx] + list [encoding convertfrom -failindex idx ascii AÁ] [set idx] } -result {A 1} test encoding-19.6 {TableFromUtfProc} -body { - list [encoding convertfrom -failindex idx -profile strict ascii AÁB] [set idx] + list [encoding convertfrom -failindex idx ascii AÁB] [set idx] } -result {A 1} test encoding-20.1 {TableFreefProc} { @@ -766,7 +766,7 @@ test encoding-24.3 {EscapeFreeProc on open channels} {stdio} { } [list 3 "乎乞也 (\\u4E4E\\u4E5E\\u4E5F)"] test encoding-24.4 {Parse valid or invalid utf-8} { - string length [encoding convertfrom utf-8 "\xC0\x80"] + string length [encoding convertfrom -profile tcl8 utf-8 "\xC0\x80"] } 1 test encoding-24.5 {Parse valid or invalid utf-8} { string length [encoding convertfrom -profile tcl8 utf-8 "\xC0\x81"] @@ -790,16 +790,16 @@ test encoding-24.11 {Parse valid or invalid utf-8} { string length [encoding convertfrom -profile tcl8 utf-8 "\xEF\xBF\xBF"] } 1 test encoding-24.12 {Parse valid or invalid utf-8} -body { - encoding convertfrom -profile strict utf-8 "\xC0\x81" + encoding convertfrom utf-8 "\xC0\x81" } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xC0'} test encoding-24.13 {Parse valid or invalid utf-8} -body { - encoding convertfrom -profile strict utf-8 "\xC1\xBF" + encoding convertfrom utf-8 "\xC1\xBF" } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xC1'} test encoding-24.14 {Parse valid or invalid utf-8} { string length [encoding convertfrom utf-8 "\xC2\x80"] } 1 test encoding-24.15 {Parse valid or invalid utf-8} -body { - encoding convertfrom utf-8 "Z\xE0\x80" + encoding convertfrom -profile tcl8 utf-8 "Z\xE0\x80" } -result Z\xE0\u20AC test encoding-24.16 {Parse valid or invalid utf-8} -constraints testbytestring -body { encoding convertto utf-8 [testbytestring "Z\u4343\x80"] @@ -810,11 +810,8 @@ test encoding-24.17 {Parse valid or invalid utf-8} -constraints testbytestring - test encoding-24.18 {Parse valid or invalid utf-8} -constraints testbytestring -body { encoding convertto utf-8 [testbytestring "Z\xE0\x80xxxxxx"] } -result "Z\xC3\xA0\xE2\x82\xACxxxxxx" -test encoding-24.19.1 {Parse valid or invalid utf-8} -body { - encoding convertto -profile tcl8 utf-8 "ZX\uD800" -} -result ZX\xED\xA0\x80 -test encoding-24.19.2 {Parse valid or invalid utf-8} -body { - encoding convertto -profile strict utf-8 "ZX\uD800" +test encoding-24.19 {Parse valid or invalid utf-8} -body { + encoding convertto utf-8 "ZX\uD800" } -returnCodes 1 -match glob -result "unexpected character at index 2: 'U+00D800'" test encoding-24.20 {Parse with -profile tcl8 but without providing encoding} -body { encoding convertfrom -profile tcl8 "\x20" @@ -828,26 +825,26 @@ test encoding-24.22 {Syntax error, two encodings} -body { test encoding-24.23 {Syntax error, two encodings} -body { encoding convertto iso8859-1 utf-8 "ZX\uD800" } -result {bad option "iso8859-1": must be -profile or -failindex} -returnCodes error -test encoding-24.24 {Parse invalid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 "\xC0\x80\x00\x00" +test encoding-24.24 {Parse invalid utf-8 with} -body { + encoding convertfrom utf-8 "\xC0\x80\x00\x00" } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xC0'} -test encoding-24.25 {Parse invalid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 "\x40\x80\x00\x00" +test encoding-24.25 {Parse invalid utf-8 with} -body { + encoding convertfrom utf-8 "\x40\x80\x00\x00" } -returnCodes 1 -result {unexpected byte sequence starting at index 1: '\x80'} -test encoding-24.26 {Parse valid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 "\xF1\x80\x80\x80" +test encoding-24.26 {Parse valid utf-8 with} -body { + encoding convertfrom utf-8 "\xF1\x80\x80\x80" } -result \U40000 -test encoding-24.27 {Parse invalid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 "\xF0\x80\x80\x80" +test encoding-24.27 {Parse invalid utf-8 with} -body { + encoding convertfrom utf-8 "\xF0\x80\x80\x80" } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xF0'} -test encoding-24.28 {Parse invalid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 "\xFF\x00\x00" +test encoding-24.28 {Parse invalid utf-8 with} -body { + encoding convertfrom utf-8 "\xFF\x00\x00" } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xFF'} test encoding-24.29 {Parse invalid utf-8} -body { encoding convertfrom utf-8 \xEF\xBF\xBF } -result \uFFFF -test encoding-24.30 {Parse noncharacter with -profile strict} -body { - encoding convertfrom -profile strict utf-8 \xEF\xBF\xBF +test encoding-24.30 {Parse noncharacter with} -body { + encoding convertfrom utf-8 \xEF\xBF\xBF } -result \uFFFF test encoding-24.31 {Parse invalid utf-8 with -profile tcl8} -body { encoding convertfrom -profile tcl8 utf-8 \xEF\xBF\xBF @@ -855,35 +852,32 @@ test encoding-24.31 {Parse invalid utf-8 with -profile tcl8} -body { test encoding-24.32 {Try to generate invalid utf-8} -body { encoding convertto utf-8 \uFFFF } -result \xEF\xBF\xBF -test encoding-24.33 {Try to generate noncharacter with -profile strict} -body { - encoding convertto -profile strict utf-8 \uFFFF +test encoding-24.33 {Try to generate noncharacter with} -body { + encoding convertto utf-8 \uFFFF } -result \xEF\xBF\xBF test encoding-24.34 {Try to generate invalid utf-8 with -profile tcl8} -body { encoding convertto -profile tcl8 utf-8 \uFFFF } -result \xEF\xBF\xBF test encoding-24.35 {Parse invalid utf-8} -constraints utf32 -body { - encoding convertfrom utf-8 \xED\xA0\x80 + encoding convertfrom -profile tcl8 utf-8 \xED\xA0\x80 } -result \uD800 -test encoding-24.36 {Parse invalid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 \xED\xA0\x80 +test encoding-24.36 {Parse invalid utf-8 with} -body { + encoding convertfrom utf-8 \xED\xA0\x80 } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xED'} test encoding-24.37 {Parse invalid utf-8 with -profile tcl8} -body { encoding convertfrom -profile tcl8 utf-8 \xED\xA0\x80 } -result \uD800 -test encoding-24.38.1 {Try to generate invalid utf-8} -body { - encoding convertto -profile tcl8 utf-8 \uD800 -} -result \xED\xA0\x80 -test encoding-24.38.2 {Try to generate invalid utf-8} -body { - encoding convertto -profile strict utf-8 \uD800 +test encoding-24.38 {Try to generate invalid utf-8} -body { + encoding convertto utf-8 \uD800 } -returnCodes 1 -result {unexpected character at index 0: 'U+00D800'} -test encoding-24.39 {Try to generate invalid utf-8 with -profile strict} -body { - encoding convertto -profile strict utf-8 \uD800 +test encoding-24.39 {Try to generate invalid utf-8 with} -body { + encoding convertto utf-8 \uD800 } -returnCodes 1 -result {unexpected character at index 0: 'U+00D800'} test encoding-24.40 {Try to generate invalid utf-8 with -profile tcl8} -body { encoding convertto -profile tcl8 utf-8 \uD800 } -result \xED\xA0\x80 -test encoding-24.41 {Parse invalid utf-8 with -profile strict} -body { - encoding convertfrom -profile strict utf-8 \xED\xA0\x80\xED\xB0\x80 +test encoding-24.41 {Parse invalid utf-8 with} -body { + encoding convertfrom utf-8 \xED\xA0\x80\xED\xB0\x80 } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xED'} test encoding-24.42 {Parse invalid utf-8, fallback to cp1252 [885c86a9a0]} -body { encoding convertfrom -profile tcl8 utf-8 \xF0\x80\x80\x80 @@ -891,11 +885,11 @@ test encoding-24.42 {Parse invalid utf-8, fallback to cp1252 [885c86a9a0]} -body test encoding-24.43 {Parse invalid utf-8, fallback to cp1252 [885c86a9a0]} -body { encoding convertfrom -profile tcl8 utf-8 \x80 } -result \u20AC -test encoding-24.44 {Try to generate invalid ucs-2 with -profile strict} -body { - encoding convertto -profile strict ucs-2 \uD800 +test encoding-24.44 {Try to generate invalid ucs-2 with} -body { + encoding convertto ucs-2 \uD800 } -returnCodes 1 -result {unexpected character at index 0: 'U+00D800'} -test encoding-24.45 {Try to generate invalid ucs-2 with -profile strict} -body { - encoding convertto -profile strict ucs-2 \U10000 +test encoding-24.45 {Try to generate invalid ucs-2 with} -body { + encoding convertto ucs-2 \U10000 } -returnCodes 1 -result {unexpected character at index 0: 'U+010000'} file delete [file join [temporaryDirectory] iso2022.txt] diff --git a/tests/encodingVectors.tcl b/tests/encodingVectors.tcl index 1b569a1..2f97d1f 100644 --- a/tests/encodingVectors.tcl +++ b/tests/encodingVectors.tcl @@ -10,7 +10,7 @@ # List of defined encoding profiles set encProfiles {tcl8 strict replace} -set encDefaultProfile tcl8; # Should reflect the default from implementation +set encDefaultProfile strict; # Should reflect the default from implementation # encValidStrings - Table of valid strings. # diff --git a/tests/io.test b/tests/io.test index 96e5ea6..2f2adc3 100644 --- a/tests/io.test +++ b/tests/io.test @@ -1195,7 +1195,7 @@ test io-7.3 {FilterInputBytes: split up character at EOF} {testchannel} { puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" close $f set f [open $path(test1)] - fconfigure $f -encoding shiftjis + fconfigure $f -encoding shiftjis -profile tcl8 set x [list [gets $f line] $line] lappend x [tell $f] [testchannel inputbuffered $f] [eof $f] lappend x [gets $f line] $line @@ -1620,7 +1620,7 @@ test io-12.9 {ReadChars: multibyte chars split} -body { puts -nonewline $f [string repeat a 9]\xC2 close $f set f [open $path(test1)] - fconfigure $f -encoding utf-8 -buffersize 10 + fconfigure $f -encoding utf-8 -profile tcl8 -buffersize 10 set in [read $f] close $f scan [string index $in end] %c @@ -1633,7 +1633,7 @@ test io-12.10 {ReadChars: multibyte chars split} -body { puts -nonewline $f [string repeat a 9]\xC2 close $f set f [open $path(test1)] - fconfigure $f -encoding utf-8 -buffersize 11 + fconfigure $f -encoding utf-8 -profile tcl8 -buffersize 11 set in [read $f] close $f scan [string index $in end] %c @@ -7926,6 +7926,8 @@ test io-53.5 {CopyData: error during fcopy} {socket fcopy} { set out [socket 127.0.0.1 [lindex [fconfigure $listen -sockname] 2]] catch {unset fcopyTestDone} close $listen ;# This means the socket open never really succeeds + fconfigure $in -encoding utf-8 + fconfigure $out -encoding utf-8 fcopy $in $out -command [namespace code FcopyTestDone] variable fcopyTestDone if {![info exists fcopyTestDone]} { @@ -9123,7 +9125,7 @@ test io-74.1 {[104f2885bb] improper cache validity check} -setup { removeFile io-74.1 } -returnCodes error -match glob -result {can not find channel named "*"} -test io-75.1 {multibyte encoding error read results in raw bytes (-nocomplainencoding 1)} -setup { +test io-75.1 {multibyte encoding error read results in raw bytes (-profile tcl8)} -setup { set fn [makeFile {} io-75.1] set f [open $fn w+] fconfigure $f -encoding binary @@ -9214,7 +9216,7 @@ test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup { removeFile io-75.5 } -result 4181 -test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup { +test io-75.6 {invalid utf-8 encoding read is not ignored (-profile strict)} -setup { set fn [makeFile {} io-75.6] set f [open $fn w+] fconfigure $f -encoding binary @@ -9224,13 +9226,18 @@ test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -set seek $f 0 fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict } -body { - gets $f + try { + read $f + } on error {result options} { + set data [dict get $options -data] + } + lappend data $result } -cleanup { close $f removeFile io-75.6 -} -match glob -returnCodes 1 -result {error reading "*": invalid or incomplete multibyte or wide character} +} -match glob -result {A {error reading "*": invalid or incomplete multibyte or wide character}} -test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup { +test io-75.7 {invalid utf-8 encoding eof handling (-profile strict)} -setup { set fn [makeFile {} io-75.7] set f [open $fn w+] fconfigure $f -encoding binary @@ -9240,11 +9247,18 @@ test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -set seek $f 0 fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict } -body { - read $f + try { + read $f + } on error {result options} { + set data [dict get $options -data] + } + lappend data $result + fconfigure $f -encoding iso8859-1 + lappend data [read $f] } -cleanup { close $f removeFile io-75.7 -} -match glob -returnCodes 1 -result {error reading "*": invalid or incomplete multibyte or wide character} +} -match glob -result "A {error reading \"*\": invalid or incomplete multibyte or wide character} \x81" test io-75.8 {invalid utf-8 encoding eof handling (-profile strict)} -setup { set fn [makeFile {} io-75.8] @@ -9290,7 +9304,7 @@ test io-75.10 {incomplete multibyte encoding read is ignored} -setup { puts -nonewline $f A\xC0 flush $f seek $f 0 - fconfigure $f -encoding utf-8 -buffering none + fconfigure $f -encoding utf-8 -profile tcl8 -buffering none } -body { set d [read $f] binary scan $d H* hd @@ -9313,16 +9327,13 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup { puts -nonewline $f A\x81\xFFA flush $f seek $f 0 - fconfigure $f -encoding shiftjis -blocking 0 -eofchar "" -translation lf -profile strict + fconfigure $f -encoding shiftjis -buffering none -eofchar "" -translation lf -profile strict } -body { - set d [read $f] - binary scan $d H* hd - lappend hd [catch {set d [read $f]} msg] - lappend hd $msg + read $f } -cleanup { close $f removeFile io-75.11 -} -match glob -result {41 1 {error reading "*": invalid or incomplete multibyte or wide character}} +} -match glob -returnCodes 1 -result {error reading "*": invalid or incomplete multibyte or wide character} test io-75.12 {invalid utf-8 encoding read is ignored} -setup { set fn [makeFile {} io-75.12] @@ -9331,7 +9342,7 @@ test io-75.12 {invalid utf-8 encoding read is ignored} -setup { puts -nonewline $f A\x81 flush $f seek $f 0 - fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf + fconfigure $f -encoding utf-8 -profile tcl8 -buffering none -eofchar "" -translation lf } -body { set d [read $f] binary scan $d H* hd @@ -9348,16 +9359,13 @@ test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -se puts -nonewline $f "A\x81" flush $f seek $f 0 - fconfigure $f -encoding utf-8 -blocking 0 -eofchar "" -translation lf -profile strict + fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict } -body { - set d [read $f] - binary scan $d H* hd - lappend hd [catch {read $f} msg] - lappend hd $msg + read $f } -cleanup { close $f removeFile io-75.13 -} -match glob -result {41 1 {error reading "*": invalid or incomplete multibyte or wide character}} +} -match glob -returnCodes 1 -result {error reading "*": invalid or incomplete multibyte or wide character} # ### ### ### ######### ######### ######### diff --git a/tests/ioCmd.test b/tests/ioCmd.test index cab4745..3ea62a3 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -240,11 +240,11 @@ test iocmd-8.7 {fconfigure command} -setup { file delete $path(test1) } -body { set f1 [open $path(test1) w] - fconfigure $f1 -translation lf -eofchar {} -encoding utf-16 -profile tcl8 + fconfigure $f1 -translation lf -eofchar {} -encoding utf-16 fconfigure $f1 } -cleanup { catch {close $f1} -} -result {-blocking 1 -buffering full -buffersize 4096 -encoding utf-16 -eofchar {} -profile tcl8 -translation lf} +} -result {-blocking 1 -buffering full -buffersize 4096 -encoding utf-16 -eofchar {} -profile strict -translation lf} test iocmd-8.8 {fconfigure command} -setup { file delete $path(test1) set x {} @@ -262,11 +262,11 @@ test iocmd-8.9 {fconfigure command} -setup { } -body { set f1 [open $path(test1) w] fconfigure $f1 -translation binary -buffering none -buffersize 4040 \ - -eofchar {} -encoding binary -profile tcl8 + -eofchar {} -encoding binary fconfigure $f1 } -cleanup { catch {close $f1} -} -result {-blocking 1 -buffering none -buffersize 4040 -encoding binary -eofchar {} -profile tcl8 -translation lf} +} -result {-blocking 1 -buffering none -buffersize 4040 -encoding binary -eofchar {} -profile strict -translation lf} test iocmd-8.10 {fconfigure command} -returnCodes error -body { fconfigure a b } -result {can not find channel named "a"} diff --git a/tests/utfext.test b/tests/utfext.test index b980800..de26b6f 100644 --- a/tests/utfext.test +++ b/tests/utfext.test @@ -84,7 +84,7 @@ foreach {enc utfhex hex} $utfExtMap { } # Test for insufficient space -test xx-bufferoverflow {buffer overflow Tcl_ExternalToUtf} -body { +test xx-bufferoverflow {buffer overflow Tcl_ExternalToUtf} -constraints knownBug -body { testencoding Tcl_UtfToExternal utf-16 A {start end} {} 1 } -result [list nospace {} \xFF] diff --git a/tests/winConsole.test b/tests/winConsole.test index 3104184..4eccf81 100644 --- a/tests/winConsole.test +++ b/tests/winConsole.test @@ -198,7 +198,7 @@ test console-fconfigure-get-1.0 { Console get stdin configuration } -constraints {win interactive} -body { lsort [dict keys [fconfigure stdin]] -} -result {-blocking -buffering -buffersize -encoding -eofchar -inputmode -profile -translation} +} -result {-blocking -buffering -buffersize -encoding -eofchar -profile -inputmode -translation} set testnum 0 foreach {opt result} { diff --git a/tests/zlib.test b/tests/zlib.test index 720fdd6..544e6d4 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -292,7 +292,7 @@ test zlib-8.6 {transformation and fconfigure} -setup { } -cleanup { catch {close $fd} removeFile $file -} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf -checksum 1 -dictionary {}} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf}} +} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile strict -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile strict -translation lf -checksum 1 -dictionary {}} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile strict -translation lf}} test zlib-8.7 {transformation and fconfigure} -setup { set file [makeFile {} test.gz] set fd [open $file wb] @@ -302,7 +302,7 @@ test zlib-8.7 {transformation and fconfigure} -setup { } -cleanup { catch {close $fd} removeFile $file -} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf -checksum 0} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf}} +} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile strict -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile strict -translation lf -checksum 0} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile strict -translation lf}} # Input is headers from fetching SPDY draft # Dictionary is that which is proposed _in_ SPDY draft set spdyHeaders "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nX-Robots-Tag: noarchive\r\nLast-Modified: Tue, 05 Jun 2012 02:43:25 GMT\r\nETag: \"1338864205129|#public|0|en|||0\"\r\nExpires: Tue, 05 Jun 2012 16:17:11 GMT\r\nDate: Tue, 05 Jun 2012 16:17:06 GMT\r\nCache-Control: public, max-age=5\r\nX-Content-Type-Options: nosniff\r\nX-XSS-Protection: 1; mode=block\r\nServer: GSE\r\n" |