1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Functionality covered: operation of all IO commands, and all procedures
# defined in generic/tclIO.c.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# SCCS: @(#) io.test 1.149 98/02/10 17:49:32
if {[string compare test [info procs test]] == 1} then {source defs}
if {"[info commands testchannel]" != "testchannel"} {
puts "Skipping io tests. This application does not seem to have the"
puts "testchannel command that is needed to run these tests."
return
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# Functionality covered: operation of all IO commands, and all procedures
# defined in generic/tclIO.c.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1991-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: io.test,v 1.1.2.2 1998/09/24 23:59:27 stanton Exp $
if {[string compare test [info procs test]] == 1} then {source defs}
if {"[info commands testchannel]" != "testchannel"} {
puts "Skipping io tests. This application does not seem to have the"
puts "testchannel command that is needed to run these tests."
return
|
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
|
set result $x
testchannelevent $f set 0 none
after idle {set y done}
vwait y
close $f
lappend result $y
} {2 done}
removeFile fooBar
removeFile longfile
removeFile script
removeFile output
removeFile test1
removeFile pipe
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
|
set result $x
testchannelevent $f set 0 none
after idle {set y done}
vwait y
close $f
lappend result $y
} {2 done}
test io-34.1 {buffered data and file events, gets} {
proc accept {sock args} {
set ::s2 $sock
}
set server [socket -server accept 4040]
set s [socket localhost 4040]
vwait s2
update
fileevent $s2 readable {lappend result readable}
puts $s "12\n34567890"
flush $s
set result [gets $s2]
after 1000 {lappend result timer}
vwait result
lappend result [gets $s2]
vwait result
close $s
close $s2
close $server
set result
} {12 readable 34567890 timer}
test io-34.2 {buffered data and file events, read} {
proc accept {sock args} {
set ::s2 $sock
}
set server [socket -server accept 4040]
set s [socket localhost 4040]
vwait s2
update
fileevent $s2 readable {lappend result readable}
puts -nonewline $s "1234567890"
flush $s
set result [read $s2 1]
after 1000 {lappend result timer}
vwait result
lappend result [read $s2 9]
vwait result
close $s
close $s2
close $server
set result
} {1 readable 234567890 timer}
removeFile fooBar
removeFile longfile
removeFile script
removeFile output
removeFile test1
removeFile pipe
|