Diff
Not logged in

Differences From Artifact [251ad64e45]:

To Artifact [2fd88c792e]:


8810
8811
8812
8813
8814
8815
8816
8817
8818


8819
8820
8821
8822


8823
8824
8825
8826
8827
8828
8829
8810
8811
8812
8813
8814
8815
8816


8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831







-
-
+
+




+
+







    read [teststringobj get 2]
} -cleanup {
    interp delete child
    testobj freeallvars
    removeFile io-74.1
} -returnCodes error -match glob -result {can not find channel named "*"}

# Note: the following tests are in preparation for TCL 9.0, where those should
# result in an error result
# Note: the following tests 75.1 to 75.3 are in preparation for TCL 9.0, where
# those should result in an error result
test io-75.1 {multibyte encoding error read results in raw bytes} -setup {
	set fn [makeFile {} io-75.1]
    set f [open $fn w+]
    fconfigure $f -encoding binary
	# In UTF-8, a byte 0xCx starts a multibyte sequence and must be followed
	# by a byte > 0x7F. This is violated to get an invalid sequence.
	puts -nonewline $f "A\xC0\x40"
	flush $f
	seek $f 0
	fconfigure $f -encoding utf-8 -buffering none
} -body {
	read $f
} -cleanup {
8843
8844
8845
8846
8847
8848
8849



















8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+











	seek $f 0
	read $f
} -cleanup {
	close $f
	removeFile io-75.2
} -returnCodes ok -result "A?"

# Incomplete sequence test.
# This error may IMHO only be detected with the close.
# But the read already returns the incomplete sequence.
test io-75.3 {incomplete multibyte encoding read is ignored} -setup {
	set fn [makeFile {} io-75.3]
    set f [open $fn w+]
    fconfigure $f -encoding binary
	puts -nonewline $f "A\xC0"
	flush $f
	seek $f 0
	fconfigure $f -encoding utf-8 -buffering none
} -body {
	set d [read $f]
	close $f
	set d
} -cleanup {
	removeFile io-75.3
} -returnCodes ok -result "A\xC0"

# ### ### ### ######### ######### #########

# cleanup
foreach file [list fooBar longfile script script2 output test1 pipe my_script \
	test2 test3 cat stdout kyrillic.txt utf8-fcopy.txt utf8-rp.txt] {
    removeFile $file
}
cleanupTests
}
namespace delete ::tcl::test::io
return