| ︙ | | |
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
-
+
|
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {[lsearch [namespace children] ::tcltest] == -1} {
if {"::tcltest" ni [namespace children]} {
package require tcltest 2
}
namespace eval ::tcl::test::io {
namespace import ::tcltest::*
variable umaskValue
|
| ︙ | | |
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
|
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
|
-
+
-
+
-
+
|
lappend l [gets $f]
lappend l [tell $f]
lappend l [eof $f]
close $f
set l
} [list 7 a\rb\rc 7 {} 7 1]
test io-50.1 {testing handler deletion} {testchannelevent} {
test io-50.1 {testing handler deletion} {testchannelevent nonPortable} {
file delete $path(test1)
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list delhandler $f]]
proc delhandler {f} {
variable z
set z called
testchannelevent $f delete 0
}
set z not_called
update
close $f
set z
} called
test io-50.2 {testing handler deletion with multiple handlers} {testchannelevent} {
test io-50.2 {testing handler deletion with multiple handlers} {testchannelevent nonPortable} {
file delete $path(test1)
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list delhandler $f 1]]
testchannelevent $f add readable [namespace code [list delhandler $f 0]]
proc delhandler {f i} {
variable z
lappend z "called delhandler $f $i"
testchannelevent $f delete 0
}
set z ""
update
close $f
string compare [string tolower $z] \
[list [list called delhandler $f 0] [list called delhandler $f 1]]
} 0
test io-50.3 {testing handler deletion with multiple handlers} {testchannelevent} {
test io-50.3 {testing handler deletion with multiple handlers} {testchannelevent nonPortable} {
file delete $path(test1)
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list notcalled $f 1]]
testchannelevent $f add readable [namespace code [list delhandler $f 0]]
set z ""
|
| ︙ | | |
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
|
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
|
-
+
|
set z ""
update
close $f
string compare [string tolower $z] \
[list [list delhandler $f 0 called] \
[list delhandler $f 0 deleted myself]]
} 0
test io-50.4 {testing handler deletion vs reentrant calls} {testchannelevent} {
test io-50.4 {testing handler deletion vs reentrant calls} {testchannelevent nonPortable} {
file delete $path(test1)
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list delrecursive $f]]
proc delrecursive {f} {
variable z
|
| ︙ | | |
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
|
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
|
-
-
+
+
-
-
+
|
update
}
}
variable u toplevel
variable z ""
update
close $f
string compare [string tolower $z] \
{{delrecursive calling recursive} {delrecursive deleting recursive}}
set z
} {{delrecursive calling recursive} {delrecursive deleting recursive}}
} 0
test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent} {
test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent nonPortable} {
file delete $path(test1)
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list notcalled $f]]
testchannelevent $f add readable [namespace code [list del $f]]
proc notcalled {f} {
|
| ︙ | | |
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
|
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
|
-
-
-
+
+
+
-
-
+
|
lappend z "del after update"
}
}
set z ""
set u toplevel
update
close $f
string compare [string tolower $z] \
[list {del calling recursive} {del deleted notcalled} \
{del deleted myself} {del after update}]
set z
} [list {del calling recursive} {del deleted notcalled} \
{del deleted myself} {del after update}]
} 0
test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent} {
test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent nonPortable} {
file delete $path(test1)
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list second $f]]
testchannelevent $f add readable [namespace code [list first $f]]
proc first {f} {
|
| ︙ | | |
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
|
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
|
-
-
-
-
+
+
+
+
-
|
testchannelevent $f removeall
}
}
set z ""
set u toplevel
update
close $f
string compare [string tolower $z] \
[list {first called} {first called not toplevel} \
{second called, first time} {second called, second time} \
{first after update}]
set z
} [list {first called} {first called not toplevel} \
{second called, first time} {second called, second time} \
{first after update}]
} 0
test io-51.1 {Test old socket deletion on Macintosh} {socket} {
set x 0
set result ""
proc accept {s a p} {
variable x
variable wait
|
| ︙ | | |