summaryrefslogtreecommitdiffstats
path: root/tests/ioCmd.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-10-31 13:53:33 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-10-31 13:53:33 (GMT)
commitf0c90cb3e57992ace7caa6e80973c7c5c9812ceb (patch)
tree595ae9ba3a4c0b09c5c8a781c9c96988fcb662b5 /tests/ioCmd.test
parent625917201f908997486fc9085f5056c952392dad (diff)
downloadtcl-f0c90cb3e57992ace7caa6e80973c7c5c9812ceb.zip
tcl-f0c90cb3e57992ace7caa6e80973c7c5c9812ceb.tar.gz
tcl-f0c90cb3e57992ace7caa6e80973c7c5c9812ceb.tar.bz2
Cleanup and ANSIfy
Diffstat (limited to 'tests/ioCmd.test')
-rw-r--r--tests/ioCmd.test1417
1 files changed, 461 insertions, 956 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 2c95b13..7c018ae 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -13,14 +13,19 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: ioCmd.test,v 1.24 2005/08/24 17:56:24 andreas_kupries Exp $
+# RCS: @(#) $Id: ioCmd.test,v 1.25 2005/10/31 13:53:33 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2
namespace import -force ::tcltest::*
}
-testConstraint fcopy [llength [info commands fcopy]]
+# Custom constraints used in this file
+testConstraint fcopy [llength [info commands fcopy]]
+testConstraint testchannel [llength [info commands testchannel]]
+testConstraint testthread [llength [info commands testthread]]
+
+#----------------------------------------------------------------------
test iocmd-1.1 {puts command} {
list [catch {puts} msg] $msg
@@ -62,7 +67,6 @@ test iocmd-1.8 {puts command} {
file size $path(test1)
} 9
-
test iocmd-2.1 {flush command} {
list [catch {flush} msg] $msg
} {1 {wrong # args: should be "flush channelId"}}
@@ -250,14 +254,12 @@ test iocmd-8.11 {fconfigure command} {
close $chan
set res
} {1 {bad option "-froboz": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, or -translation}}
-
test iocmd-8.12 {fconfigure command} {
set chan [open $path(fconfigure.dummy) r]
set res [list [catch {fconfigure $chan -b blarfo} msg] $msg]
close $chan
set res
} {1 {bad option "-b": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, or -translation}}
-
test iocmd-8.13 {fconfigure command} {
set chan [open $path(fconfigure.dummy) r]
set res [list [catch {fconfigure $chan -buffer blarfo} msg] $msg]
@@ -270,62 +272,75 @@ removeFile fconfigure.dummy
test iocmd-8.14 {fconfigure command} {
fconfigure stdin -buffers
} 4096
-
-proc iocmdSSETUP {} {
- uplevel {
- set srv [socket -server iocmdSRV 0]
- set port [lindex [fconfigure $srv -sockname] 2]
- proc iocmdSRV {sock ip port} {close $sock}
- set cli [socket 127.0.0.1 $port]
- }
-}
-proc iocmdSSHTDWN {} {
- uplevel {
- close $cli
- close $srv
- unset cli srv port
- rename iocmdSRV {}
- }
-}
-
-test iocmd-8.15.1 {fconfigure command / tcp channel} {socket unixOrPc} {
- iocmdSSETUP
- set r [list [catch {fconfigure $cli -blah} msg] $msg]
- iocmdSSHTDWN
- set r
-} {1 {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, -peername, or -sockname}}
-test iocmd-8.16 {fconfigure command / tcp channel} {socket} {
- iocmdSSETUP
- set r [expr [lindex [fconfigure $cli -peername] 2]==$port]
- iocmdSSHTDWN
- set r
-} 1
-test iocmd-8.17 {fconfigure command / tcp channel} {nonPortable} {
- # It is possible that you don't get the connection reset by peer
- # error but rather a valid answer. depends of the tcp implementation
- iocmdSSETUP
- update;
- puts $cli "blah"; flush $cli; # that flush could/should fail too
- update;
- set r [catch {fconfigure $cli -peername} msg]
- iocmdSSHTDWN
- regsub -all {can([^:])+: } $r {} r;
- set r
-} 1
-test iocmd-8.18 {fconfigure command / unix tty channel} {nonPortable unix} {
- # might fail if /dev/ttya is unavailable
- set tty [open /dev/ttya]
- set r [list [catch {fconfigure $tty -blah blih} msg] $msg];
- close $tty;
- set r;
-} {1 {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, or -mode}}
-test iocmd-8.19 {fconfigure command / win tty channel} {nonPortable win} {
- # might fail if com1 is unavailable
- set tty [open com1]
- set r [list [catch {fconfigure $tty -blah blih} msg] $msg];
- close $tty;
- set r;
-} {1 {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, -mode, or -pollinterval}}
+test iocmd-8.15.1 {fconfigure command / tcp channel} -constraints {socket unixOrPc} -setup {
+ set srv [socket -server iocmdSRV 0]
+ set port [lindex [fconfigure $srv -sockname] 2]
+ proc iocmdSRV {sock ip port} {close $sock}
+ set cli [socket 127.0.0.1 $port]
+} -body {
+ fconfigure $cli -blah
+} -cleanup {
+ close $cli
+ close $srv
+ unset cli srv port
+ rename iocmdSRV {}
+} -returnCodes error -result {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, -peername, or -sockname}
+test iocmd-8.16 {fconfigure command / tcp channel} -constraints socket -setup {
+ set srv [socket -server iocmdSRV 0]
+ set port [lindex [fconfigure $srv -sockname] 2]
+ proc iocmdSRV {sock ip port} {close $sock}
+ set cli [socket 127.0.0.1 $port]
+} -body {
+ expr {[lindex [fconfigure $cli -peername] 2] == $port}
+} -cleanup {
+ close $cli
+ close $srv
+ unset cli srv port
+ rename iocmdSRV {}
+} -result 1
+test iocmd-8.17 {fconfigure command / tcp channel} -constraints nonPortable -setup {
+ set srv [socket -server iocmdSRV 0]
+ set port [lindex [fconfigure $srv -sockname] 2]
+ proc iocmdSRV {sock ip port} {close $sock}
+ set cli [socket 127.0.0.1 $port]
+} -body {
+ # It is possible that you don't get the connection reset by peer
+ # error but rather a valid answer. Depends on the tcp implementation
+ update
+ puts $cli "blah"
+ flush $cli; # that flush could/should fail too
+ update
+ regsub -all {can([^:])+: } [catch {fconfigure $cli -peername} msg] {}
+} -cleanup {
+ close $cli
+ close $srv
+ unset cli srv port
+ rename iocmdSRV {}
+} -result 1
+test iocmd-8.18 {fconfigure command / unix tty channel} -constraints {nonPortable unix} -setup {
+ set tty ""
+} -body {
+ # might fail if /dev/ttya is unavailable
+ set tty [open /dev/ttya]
+ fconfigure $tty -blah blih
+} -cleanup {
+ if {$tty ne ""} {
+ close $tty
+ }
+} -returnCodes error -result {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, or -mode}
+test iocmd-8.19 {fconfigure command / win tty channel} -constraints {nonPortable win} -setup {
+ set tty ""
+} -body {
+ # might fail early if com1 is unavailable
+ set tty [open com1]
+ fconfigure $tty -blah blih
+} -cleanup {
+ if {$tty ne ""} {
+ close $tty
+ }
+} -returnCodes error -result {bad option "-blah": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -translation, -mode, -handshake, -pollinterval, -sysbuffer, -timeout, -ttycontrol, or -xchar}
+# TODO: Test parsing of serial channel options (nonportable, since requires an
+# open channel to work with).
test iocmd-9.1 {eof command} {
list [catch {eof} msg] $msg $errorCode
@@ -449,7 +464,7 @@ test iocmd-12.10 {POSIX open access modes: BINARY} {
} 5
test iocmd-12.11 {POSIX open access modes: BINARY} {
set f [open $path(test1) {WRONLY BINARY TRUNC}]
- puts $f \u0248 ;# gets truncated to \u0048
+ puts $f \u0248 ;# gets truncated to \u0048
close $f
set f [open $path(test1) r]
fconfigure $f -translation binary
@@ -476,7 +491,7 @@ test iocmd-13.5 {errors in open command} {
test iocmd-13.6 {errors in open command} {
set msg [list [catch {open _non_existent_} msg] $msg $errorCode]
regsub [file join {} _non_existent_] $msg "_non_existent_" msg
- string tolower $msg
+ string tolower $msg
} {1 {couldn't open "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}}
test iocmd-13.7 {errors in open command} {
list [catch {open $path(test1) b} msg] $msg
@@ -541,10 +556,8 @@ test iocmd-15.5 {Tcl_FcopyObjCmd} {fcopy} {
} {1 {wrong # args: should be "fcopy input output ?-size size? ?-command callback?"}}
set path(test2) [makeFile {} test2]
-
set f [open $path(test1) w]
close $f
-
set rfile [open $path(test1) r]
set wfile [open $path(test2) w]
@@ -580,7 +593,6 @@ test iocmd-20.0 {chan, wrong#args} {
catch {chan} msg
set msg
} {wrong # args: should be "chan subcommand ?argument ...?"}
-
test iocmd-20.1 {chan, unknown method} {
catch {chan foo} msg
set msg
@@ -593,120 +605,102 @@ test iocmd-21.0 {chan create, wrong#args, not enough} {
catch {chan create} msg
set msg
} {wrong # args: should be "chan create mode cmdprefix"}
-
test iocmd-21.1 {chan create, wrong#args, too many} {
catch {chan create a b c} msg
set msg
} {wrong # args: should be "chan create mode cmdprefix"}
-
test iocmd-21.2 {chan create, invalid r/w mode, empty} {
proc foo {} {}
catch {chan create {} foo} msg
rename foo {}
set msg
} {bad mode list: is empty}
-
test iocmd-21.3 {chan create, invalid r/w mode, bad string} {
proc foo {} {}
catch {chan create {c} foo} msg
rename foo {}
set msg
} {bad mode "c": must be read or write}
-
test iocmd-21.4 {chan create, bad handler, not a list} {
catch {chan create {r w} "foo \{"} msg
set msg
} {unmatched open brace in list}
-
test iocmd-21.5 {chan create, bad handler, not a command} {
catch {chan create {r w} foo} msg
set msg
} {Initialize failure: invalid command name "foo"}
-
test iocmd-21.6 {chan create, initialize failed, bad signature} {
proc foo {} {}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: wrong # args: should be "foo"}
-
test iocmd-21.7 {chan create, initialize failed, bad signature} {
proc foo {} {}
catch {chan create {r w} ::foo} msg
rename foo {}
set msg
} {Initialize failure: wrong # args: should be "::foo"}
-
test iocmd-21.8 {chan create, initialize failed, bad result, not a list} {
proc foo {args} {return "\{"}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: unmatched open brace in list}
-
test iocmd-21.9 {chan create, initialize failed, bad result, not a list} {
proc foo {args} {return \{\{\}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: unmatched open brace in list}
-
test iocmd-21.10 {chan create, initialize failed, bad result, empty list} {
proc foo {args} {}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: Not all required methods supported}
-
test iocmd-21.11 {chan create, initialize failed, bad result, bogus method name} {
proc foo {args} {return 1}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: bad method "1": must be blocking, cget, cgetall, configure, finalize, initialize, read, seek, watch, or write}
-
test iocmd-21.12 {chan create, initialize failed, bad result, ambiguous method name} {
proc foo {args} {return {a b c}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: ambiguous method "c": must be blocking, cget, cgetall, configure, finalize, initialize, read, seek, watch, or write}
-
test iocmd-21.13 {chan create, initialize failed, bad result, required methods missing} {
proc foo {args} {return {initialize finalize}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: Not all required methods supported}
-
test iocmd-21.14 {chan create, initialize failed, bad result, mode/handler mismatch} {
proc foo {args} {return {initialize finalize watch read}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: Writing not supported, but requested}
-
test iocmd-21.15 {chan create, initialize failed, bad result, mode/handler mismatch} {
proc foo {args} {return {initialize finalize watch write}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: Reading not supported, but requested}
-
test iocmd-21.16 {chan create, initialize failed, bad result, cget(all) mismatch} {
proc foo {args} {return {initialize finalize watch cget write read}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: 'cgetall' not supported, but should be, as 'cget' is}
-
test iocmd-21.17 {chan create, initialize failed, bad result, cget(all) mismatch} {
proc foo {args} {return {initialize finalize watch cgetall read write}}
catch {chan create {r w} foo} msg
rename foo {}
set msg
} {Initialize failure: 'cget' not supported, but should be, as 'cgetall' is}
-
test iocmd-21.18 {chan create, initialize ok, creates channel} -match glob -body {
proc foo {args} {
global res
@@ -722,7 +716,6 @@ test iocmd-21.18 {chan create, initialize ok, creates channel} -match glob -body
rename foo {}
set res
} -result {{} {initialize rc* {read write}} rc* {finalize rc*} {} {}}
-
test iocmd-21.19 {chan create, init failure -> no channel, no finalize} -match glob -body {
proc foo {args} {
global res
@@ -741,8 +734,8 @@ test iocmd-21.19 {chan create, init failure -> no channel, no finalize} -match g
# --- --- --- --------- --------- ---------
# Helper commands to record the arguments to handler methods.
-proc note {item} {global res ; lappend res $item ; return}
-proc track {} {upvar args item ; note $item; return}
+proc note {item} {global res; lappend res $item; return}
+proc track {} {upvar args item; note $item; return}
proc notes {items} {foreach i $items {note $i}}
# Helper command, canned result for 'initialize' method.
@@ -753,14 +746,12 @@ proc init {args} {
lappend args initialize finalize watch read write
return -code return $args
}
-
proc oninit {args} {
upvar args hargs
if {[lindex $hargs 0] ne "initialize"} {return}
lappend args initialize finalize watch read write
return -code return $args
}
-
proc onfinal {} {
upvar args hargs
if {[lindex $hargs 0] ne "finalize"} {return}
@@ -772,110 +763,81 @@ proc onfinal {} {
test iocmd-22.1 {chan finalize, handler destruction has no effect on channel} -match glob -body {
set res {}
- proc foo {args} {track ; oninit; return}
+ proc foo {args} {track; oninit; return}
note [set c [chan create {r w} foo]]
-
rename foo {}
-
note [file channels rc*]
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
note [file channels rc*]
-
set res
} -result {{initialize rc* {read write}} rc* rc* 1 {invalid command name "foo"} {}}
-
test iocmd-22.2 {chan finalize, for close} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return {}}
+ proc foo {args} {track; oninit; return {}}
note [set c [chan create {r w} foo]]
-
close $c
-
# Close deleted the channel.
note [file channels rc*]
-
# Channel destruction does not kill handler command!
note [info command foo]
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} {} foo}
-
test iocmd-22.3 {chan finalize, for close, error, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code error 5}
+ proc foo {args} {track; oninit; return -code error 5}
note [set c [chan create {r w} foo]]
-
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
# Channel is gone despite error.
note [file channels rc*]
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 5 {}}
-
test iocmd-22.4 {chan finalize, for close, error, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; error FOO}
+ proc foo {args} {track; oninit; error FOO}
note [set c [chan create {r w} foo]]
-
- note [catch {close $c} msg] ; note $msg
-
+ note [catch {close $c} msg]; note $msg
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 FOO}
-
test iocmd-22.5 {chan finalize, for close, arbitrary result, ignored} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return SOMETHING}
+ proc foo {args} {track; oninit; return SOMETHING}
note [set c [chan create {r w} foo]]
-
note [catch {close $c} msg]; note $msg
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 0 {}}
-
test iocmd-22.6 {chan finalize, for close, break, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code 3}
+ proc foo {args} {track; oninit; return -code 3}
note [set c [chan create {r w} foo]]
-
- note [catch {close $c} msg] ; note $msg
-
+ note [catch {close $c} msg]; note $msg
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 {}}
-
test iocmd-22.7 {chan finalize, for close, continue, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code 4}
+ proc foo {args} {track; oninit; return -code 4}
note [set c [chan create {r w} foo]]
-
- note [catch {close $c} msg] ; note $msg
-
+ note [catch {close $c} msg]; note $msg
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 {}}
-
test iocmd-22.8 {chan finalize, for close, custom code, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code 777 BANG}
+ proc foo {args} {track; oninit; return -code 777 BANG}
note [set c [chan create {r w} foo]]
-
- note [catch {close $c} msg] ; note $msg
-
+ note [catch {close $c} msg]; note $msg
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 BANG}
-
test iocmd-22.9 {chan finalize, for close, ignore level, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -level 5 -code 777 BANG}
+ proc foo {args} {track; oninit; return -level 5 -code 777 BANG}
note [set c [chan create {r w} foo]]
-
- note [catch {close $c} msg opt] ; note $msg ; note $opt
-
+ note [catch {close $c} msg opt]; note $msg; note $opt
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
@@ -886,114 +848,95 @@ test iocmd-22.9 {chan finalize, for close, ignore level, close error} -match glo
test iocmd-23.1 {chan read, regular data return} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return snarf
}
set c [chan create {r w} foo]
-
note [read $c 10]
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} {read rc* 4096} snarfsnarf}
-
test iocmd-23.2 {chan read, bad data return, to much} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return [string repeat snarf 1000]
}
set c [chan create {r w} foo]
-
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} 1 {read delivered more than requested}}
-
test iocmd-23.3 {chan read, for non-readable channel} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
- note MUST_NOT_HAPPEN
+ oninit; onfinal; track; note MUST_NOT_HAPPEN
}
set c [chan create {w} foo]
-
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {1 {channel "rc*" wasn't opened for reading}}
-
test iocmd-23.4 {chan read, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!}
-
test iocmd-23.5 {chan read, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code break BOOM!
}
set c [chan create {r w} foo]
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!}
-
test iocmd-23.6 {chan read, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!}
-
test iocmd-23.7 {chan read, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code 777 BOOM!
}
set c [chan create {r w} foo]
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!}
-
test iocmd-23.8 {chan read, level is squashed} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -level 55 -code 777 BOOM!
}
set c [chan create {r w} foo]
- note [catch {read $c 2} msg opt] ; note $msg ; note $opt
+ note [catch {read $c 2} msg opt]; note $msg; note $opt
close $c
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM! {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BOOM!}}
@@ -1004,174 +947,136 @@ test iocmd-23.8 {chan read, level is squashed} -match glob -body {
test iocmd-24.1 {chan write, regular write} -match glob -body {
set res {}
proc foo {args} {
- oninit; onfinal ; track
+ oninit; onfinal; track
set written [string length [lindex $args 2]]
note $written
return $written
}
set c [chan create {r w} foo]
-
- puts -nonewline $c snarf ; flush $c
+ puts -nonewline $c snarf; flush $c
close $c
-
rename foo {}
set res
} -result {{write rc* snarf} 5}
-
test iocmd-24.2 {chan write, partial write is ok} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
set written [string length [lindex $args 2]]
if {$written > 10} {set written [expr {$written / 2}]}
note $written
return $written
}
set c [chan create {r w} foo]
-
- puts -nonewline $c snarfsnarfsnarf ; flush $c
+ puts -nonewline $c snarfsnarfsnarf; flush $c
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 7 {write rc* arfsnarf} 8}
-
test iocmd-24.3 {chan write, failed write} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note -1 ; return -1}
-
+ proc foo {args} {oninit; onfinal; track; note -1; return -1}
set c [chan create {r w} foo]
- puts -nonewline $c snarfsnarfsnarf ; flush $c
+ puts -nonewline $c snarfsnarfsnarf; flush $c
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} -1}
-
test iocmd-24.4 {chan write, non-writable channel} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg] ; note $msg
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {1 {channel "rc*" wasn't opened for writing}}
-
test iocmd-24.5 {chan write, bad result, more written than data} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return 10000}
+ proc foo {args} {oninit; onfinal; track; return 10000}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarf ; flush $c} msg] ; note $msg
+ note [catch {puts -nonewline $c snarf; flush $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarf} 1 {write wrote more than requested}}
-
test iocmd-24.6 {chan write, bad result, zero-length write} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return 0}
+ proc foo {args} {oninit; onfinal; track; return 0}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarf ; flush $c} msg] ; note $msg
+ note [catch {puts -nonewline $c snarf; flush $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarf} 1 {write wrote more than requested}}
-
test iocmd-24.7 {chan write, failed write, error return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code error BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code error BOOM!}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!}
-
test iocmd-24.8 {chan write, failed write, error return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; error BOOM!}
+ proc foo {args} {oninit; onfinal; track; error BOOM!}
set c [chan create {r w} foo]
-
- notes [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ notes [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!}
-
test iocmd-24.9 {chan write, failed write, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!}
-
test iocmd-24.10 {chan write, failed write, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!}
-
test iocmd-24.11 {chan write, failed write, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code 777 BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code 777 BOOM!}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!}
-
test iocmd-24.12 {chan write, failed write, non-numeric return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return BANG}
+ proc foo {args} {oninit; onfinal; track; return BANG}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 {expected integer but got "BANG"}}
-
test iocmd-24.13 {chan write, failed write, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -level 55 -code 777 BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -level 55 -code 777 BOOM!}
set c [chan create {r w} foo]
-
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg opt]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg opt]
note $msg
note $opt
close $c
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM! {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BOOM!}}
@@ -1181,144 +1086,115 @@ test iocmd-24.13 {chan write, failed write, level is ignored} -match glob -body
test iocmd-25.1 {chan configure, cgetall, standard options} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
note [fconfigure $c]
close $c
-
rename foo {}
set res
} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding * -eofchar {{} {}} -translation {auto *}}}
-
test iocmd-25.2 {chan configure, cgetall, no options} -match glob -body {
set res {}
- proc foo {args} {oninit cget cgetall ; onfinal ; track ; return ""}
+ proc foo {args} {oninit cget cgetall; onfinal; track; return ""}
set c [chan create {r w} foo]
-
note [fconfigure $c]
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} {-blocking 1 -buffering full -buffersize 4096 -encoding * -eofchar {{} {}} -translation {auto *}}}
-
test iocmd-25.3 {chan configure, cgetall, regular result} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return "-bar foo -snarf x"
}
set c [chan create {r w} foo]
-
note [fconfigure $c]
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} {-blocking 1 -buffering full -buffersize 4096 -encoding * -eofchar {{} {}} -translation {auto *} -bar foo -snarf x}}
-
test iocmd-25.4 {chan configure, cgetall, bad result, list of uneven length} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return "-bar"
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 {Expected list with even number of elements, got 1 element instead}}
-
test iocmd-25.5 {chan configure, cgetall, bad result, not a list} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return "\{"
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 {unmatched open brace in list}}
-
test iocmd-25.6 {chan configure, cgetall, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!}
-
test iocmd-25.7 {chan configure, cgetall, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code break BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!}
-
test iocmd-25.8 {chan configure, cgetall, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!}
-
test iocmd-25.9 {chan configure, cgetall, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code 777 BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!}
-
test iocmd-25.10 {chan configure, cgetall, level is ignored} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -level 55 -code 777 BANG
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c} msg opt]; note $msg; note $opt
close $c
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
@@ -1329,101 +1205,80 @@ test iocmd-25.10 {chan configure, cgetall, level is ignored} -match glob -body {
test iocmd-26.1 {chan configure, set standard option} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track ; note MUST_NOT_HAPPEN
- return
+ oninit configure; onfinal; track; note MUST_NOT_HAPPEN; return
}
set c [chan create {r w} foo]
-
note [fconfigure $c -translation lf]
close $c
-
rename foo {}
set res
} -result {{}}
-
test iocmd-26.2 {chan configure, set option, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!}
-
test iocmd-26.3 {chan configure, set option, ok return} -match glob -body {
set res {}
- proc foo {args} {oninit configure ; onfinal ; track ; return}
+ proc foo {args} {oninit configure; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fconfigure $c -rc-foo bar]
close $c
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} {}}
-
test iocmd-26.4 {chan configure, set option, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code break BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!}
-
test iocmd-26.5 {chan configure, set option, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!}
-
test iocmd-26.6 {chan configure, set option, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code 444 BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!}
-
test iocmd-26.7 {chan configure, set option, level is ignored} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -level 55 -code 444 BANG
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo bar} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c -rc-foo bar} msg opt]; note $msg; note $opt
close $c
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
@@ -1433,87 +1288,70 @@ test iocmd-26.7 {chan configure, set option, level is ignored} -match glob -body
test iocmd-27.1 {chan configure, get option, ok return} -match glob -body {
set res {}
- proc foo {args} {oninit cget cgetall ; onfinal ; track ; return foo}
+ proc foo {args} {oninit cget cgetall; onfinal; track; return foo}
set c [chan create {r w} foo]
-
note [fconfigure $c -rc-foo]
close $c
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} foo}
-
test iocmd-27.2 {chan configure, get option, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!}
-
test iocmd-27.3 {chan configure, get option, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!}
-
test iocmd-27.4 {chan configure, get option, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!}
-
test iocmd-27.5 {chan configure, get option, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code 333 BOOM!
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!}
-
test iocmd-27.6 {chan configure, get option, level is ignored} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -level 77 -code 333 BANG
}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -rc-foo} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c -rc-foo} msg opt]; note $msg; note $opt
close $c
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
@@ -1523,233 +1361,177 @@ test iocmd-27.6 {chan configure, get option, level is ignored} -match glob -body
test iocmd-28.1 {chan tell, not supported by handler} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
note [tell $c]
close $c
-
rename foo {}
set res
} -result {-1}
-
test iocmd-28.2 {chan tell, error return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code error BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code error BOOM!}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!}
-
test iocmd-28.3 {chan tell, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!}
-
test iocmd-28.4 {chan tell, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!}
-
test iocmd-28.5 {chan tell, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code 222 BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code 222 BOOM!}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!}
-
test iocmd-28.6 {chan tell, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -level 11 -code 222 BANG}
+ proc foo {args} {oninit seek; onfinal; track; return -level 11 -code 222 BANG}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg opt] ; note $msg ; note $opt
+ note [catch {tell $c} msg opt]; note $msg; note $opt
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
-
test iocmd-28.7 {chan tell, regular return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return 88}
+ proc foo {args} {oninit seek; onfinal; track; return 88}
set c [chan create {r w} foo]
-
note [tell $c]
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 88}
-
test iocmd-28.8 {chan tell, negative return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -1}
+ proc foo {args} {oninit seek; onfinal; track; return -1}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 {Tried to seek before origin}}
-
test iocmd-28.9 {chan tell, string return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return BOGUS}
+ proc foo {args} {oninit seek; onfinal; track; return BOGUS}
set c [chan create {r w} foo]
-
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 {expected integer but got "BOGUS"}}
-
test iocmd-28.10 {chan seek, not supported by handler} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {1 {error during seek on "rc*": invalid argument}}
-
test iocmd-28.11 {chan seek, error return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code error BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code error BOOM!}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!}
-
test iocmd-28.12 {chan seek, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!}
-
test iocmd-28.13 {chan seek, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!}
-
test iocmd-28.14 {chan seek, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code 99 BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code 99 BOOM!}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!}
-
test iocmd-28.15 {chan seek, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -level 33 -code 99 BANG}
+ proc foo {args} {oninit seek; onfinal; track; return -level 33 -code 99 BANG}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg opt] ; note $msg ; note $opt
+ note [catch {seek $c 0 start} msg opt]; note $msg; note $opt
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
-
test iocmd-28.16 {chan seek, bogus return, negative location} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -45}
+ proc foo {args} {oninit seek; onfinal; track; return -45}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 {Tried to seek before origin}}
-
test iocmd-28.17 {chan seek, bogus return, string return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return BOGUS}
+ proc foo {args} {oninit seek; onfinal; track; return BOGUS}
set c [chan create {r w} foo]
-
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]; note $msg
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 {expected integer but got "BOGUS"}}
-
test iocmd-28.18 {chan seek, ok result} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return 23}
+ proc foo {args} {oninit seek; onfinal; track; return 23}
set c [chan create {r w} foo]
-
note [seek $c 0 current]
close $c
-
rename foo {}
set res
} -result {{seek rc* 0 current} {}}
-
-foreach {n code} {
- 0 start
- 1 current
- 2 end
+foreach {testname code} {
+ iocmd-28.19.0 start
+ iocmd-28.19.1 current
+ iocmd-28.19.2 end
} {
- test iocmd-28.19.$n "chan seek, base conversion, $code" -match glob -body {
+ test $testname "chan seek, base conversion, $code" -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return 0}
-
+ proc foo {args} {oninit seek; onfinal; track; return 0}
set c [chan create {r w} foo]
note [seek $c 0 $code]
close $c
-
rename foo {}
set res
} -result [list [list seek rc* 0 $code] {}]
@@ -1760,136 +1542,103 @@ foreach {n code} {
test iocmd-29.1 {chan blocking, no handler support} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
note [fconfigure $c -blocking]
close $c
-
rename foo {}
set res
} -result {1}
-
test iocmd-29.2 {chan blocking, no handler support} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
note [fconfigure $c -blocking 0]
note [fconfigure $c -blocking]
close $c
-
rename foo {}
set res
} -result {{} 0}
-
test iocmd-29.3 {chan blocking, retrieval, handler support} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit blocking; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
note [fconfigure $c -blocking]
close $c
-
rename foo {}
set res
} -result {1}
-
test iocmd-29.4 {chan blocking, resetting, handler support} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return}
+ proc foo {args} {oninit blocking; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fconfigure $c -blocking 0]
note [fconfigure $c -blocking]
close $c
-
rename foo {}
set res
} -result {{blocking rc* 0} {} 0}
-
test iocmd-29.5 {chan blocking, setting, handler support} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return}
+ proc foo {args} {oninit blocking; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fconfigure $c -blocking 1]
note [fconfigure $c -blocking]
close $c
-
rename foo {}
set res
} -result {{blocking rc* 1} {} 1}
-
test iocmd-29.6 {chan blocking, error return} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; error BOOM!}
-
+ proc foo {args} {oninit blocking; onfinal; track; error BOOM!}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
-
+ note [catch {fconfigure $c -blocking 0} msg]; note $msg
# Catch the close. It changes blocking mode internally, and runs into the error result.
catch {close $c}
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!}
-
test iocmd-29.7 {chan blocking, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit blocking; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
-
+ note [catch {fconfigure $c -blocking 0} msg]; note $msg
catch {close $c}
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!}
-
test iocmd-29.8 {chan blocking, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit blocking; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
-
+ note [catch {fconfigure $c -blocking 0} msg]; note $msg
catch {close $c}
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!}
-
test iocmd-29.9 {chan blocking, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -code 44 BOOM!}
+ proc foo {args} {oninit blocking; onfinal; track; return -code 44 BOOM!}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
-
+ note [catch {fconfigure $c -blocking 0} msg]; note $msg
catch {close $c}
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!}
-
test iocmd-29.10 {chan blocking, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -level 99 -code 44 BANG}
+ proc foo {args} {oninit blocking; onfinal; track; return -level 99 -code 44 BANG}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -blocking 0} msg opt] ; note $msg ; note $opt
-
+ note [catch {fconfigure $c -blocking 0} msg opt]; note $msg; note $opt
catch {close $c}
rename foo {}
set res
} -result {{blocking rc* 0} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}}
-
test iocmd-29.11 {chan blocking, regular return ok, value ignored} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return BOGUS}
+ proc foo {args} {oninit blocking; onfinal; track; return BOGUS}
set c [chan create {r w} foo]
-
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
-
+ note [catch {fconfigure $c -blocking 0} msg]; note $msg
catch {close $c}
rename foo {}
set res
@@ -1900,54 +1649,43 @@ test iocmd-29.11 {chan blocking, regular return ok, value ignored} -match glob -
test iocmd-30.1 {chan watch, read interest, some return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return IGNORED}
+ proc foo {args} {oninit; onfinal; track; return IGNORED}
set c [chan create {r w} foo]
-
note [fileevent $c readable {set tick $tick}]
- close $c ;# 2nd watch, interest zero.
-
+ close $c ;# 2nd watch, interest zero.
rename foo {}
set res
} -result {{watch rc* read} {} {watch rc* {}}}
-
test iocmd-30.2 {chan watch, write interest, error return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code error BOOM!_IGNORED}
+ proc foo {args} {oninit; onfinal; track; return -code error BOOM!_IGNORED}
set c [chan create {r w} foo]
-
note [fileevent $c writable {set tick $tick}]
note [fileevent $c writable {}]
close $c
-
rename foo {}
set res
} -result {{watch rc* write} {} {watch rc* {}} {}}
-
test iocmd-30.3 {chan watch, accumulated interests} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fileevent $c writable {set tick $tick}]
note [fileevent $c readable {set tick $tick}]
note [fileevent $c writable {}]
note [fileevent $c readable {}]
close $c
-
rename foo {}
set res
} -result {{watch rc* write} {} {watch rc* {read write}} {} {watch rc* read} {} {watch rc* {}} {}}
-
test iocmd-30.4 {chan watch, unchanged interest not forwarded} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fileevent $c writable {set tick $tick}]
note [fileevent $c readable {set tick $tick}] ;# Script is changing,
note [fileevent $c readable {set tock $tock}] ;# interest does not.
-
- close $c ;# 3rd and 4th watch, removing the event handlers.
+ close $c ;# 3rd and 4th watch, removing the event handlers.
rename foo {}
set res
} -result {{watch rc* write} {} {watch rc* {read write}} {} {} {watch rc* write} {watch rc* {}}}
@@ -1957,92 +1695,70 @@ test iocmd-30.4 {chan watch, unchanged interest not forwarded} -match glob -body
test iocmd-31.1 {chan postevent, restricted to reflected channels} -match glob -body {
set c [open [makeFile {} goo] r]
-
catch {chan postevent $c {r w}} msg
-
close $c
removeFile goo
set msg
} -result {channel "file*" is not a reflected channel}
-
test iocmd-31.2 {chan postevent, unwanted events} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
- catch {chan postevent $c {r w}} msg ; note $msg
+ catch {chan postevent $c {r w}} msg; note $msg
close $c
-
rename foo {}
set res
} -result {{tried to post events channel "rc*" is not interested in}}
-
test iocmd-31.3 {chan postevent, bad input, empty list} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
- catch {chan postevent $c {}} msg ; note $msg
+ catch {chan postevent $c {}} msg; note $msg
close $c
-
rename foo {}
set res
} -result {{bad event list: is empty}}
-
test iocmd-31.4 {chan postevent, bad input, illlegal keyword} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
- catch {chan postevent $c goo} msg ; note $msg
+ catch {chan postevent $c goo} msg; note $msg
close $c
-
rename foo {}
set res
} -result {{bad event "goo": must be read or write}}
-
test iocmd-31.5 {chan postevent, bad input, not a list} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
- catch {chan postevent $c "\{"} msg ; note $msg
+ catch {chan postevent $c "\{"} msg; note $msg
close $c
-
rename foo {}
set res
} -result {{unmatched open brace in list}}
-
test iocmd-31.6 {chan postevent, posted events do happen} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fileevent $c readable {note TOCK}]
-
set stop [after 10000 {note TIMEOUT}]
after 1000 {note [chan postevent $c r]}
vwait ::res
catch {after cancel $stop}
close $c
-
rename foo {}
set res
} -result {{watch rc* read} {} TOCK {} {watch rc* {}}}
-
test iocmd-31.7 {chan postevent, posted events do happen} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
note [fileevent $c writable {note TOCK}]
-
set stop [after 10000 {note TIMEOUT}]
after 1000 {note [chan postevent $c w]}
vwait ::res
catch {after cancel $stop}
close $c
-
rename foo {}
set res
} -result {{watch rc* write} {} TOCK {} {watch rc* {}}}
@@ -2059,15 +1775,11 @@ test iocmd-31.7 {chan postevent, posted events do happen} -match glob -body {
## forwarding, and gaps due to tests not applicable to forwarding are
## left to keep this asociation.
-testConstraint testchannel [llength [info commands testchannel]]
-
# Duplicate of code in "thread.test". Find a better way of doing this
# without duplication. Maybe placement into a proc which transforms to
# nop after the first call, and placement of its defintion in a
# central location.
-testConstraint testthread [expr {[info commands testthread] != {}}]
-
if {[testConstraint testthread]} {
testthread errorproc ThreadError
@@ -2075,7 +1787,6 @@ if {[testConstraint testthread]} {
global threadError
set threadError $info
}
-
proc ThreadNullError {id info} {
# ignore
}
@@ -2087,7 +1798,6 @@ if {[testConstraint testthread]} {
## configuation variables
proc inthread {chan script args} {
-
# Test thread.
set tid [testthread create]
@@ -2103,10 +1813,10 @@ proc inthread {chan script args} {
}
testthread send $tid [list set mid $tcltest::mainThread]
testthread send $tid {
- proc note {item} {global notes ; lappend notes $item}
- proc notes {} {global notes ; return $notes}
+ proc note {item} {global notes; lappend notes $item}
+ proc notes {} {global notes; return $notes}
}
- testthread send $tid [list proc s {} [list uplevel 1 $script]] ; # (*)
+ testthread send $tid [list proc s {} [list uplevel 1 $script]]; # (*)
# Transfer channel (cut/splice aka detach/attach)
@@ -2121,7 +1831,7 @@ proc inthread {chan script args} {
set ::tres ""
testthread send -async $tid {
after 500
- catch {s} res ; # This runs the script, 's' was defined at (*)
+ catch {s} res; # This runs the script, 's' was defined at (*)
testthread send -async $mid [list set ::tres $res]
}
vwait ::tres
@@ -2137,121 +1847,97 @@ proc inthread {chan script args} {
test iocmd.tf-22.2 {chan finalize, for close} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return {}}
+ proc foo {args} {track; oninit; return {}}
note [set c [chan create {r w} foo]]
-
note [inthread $c {
close $c
# Close the deleted the channel.
file channels rc*
} c]
-
# Channel destruction does not kill handler command!
note [info command foo]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{initialize rc* {read write}} rc* {finalize rc*} {} foo}
-
test iocmd.tf-22.3 {chan finalize, for close, error, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code error 5}
+ proc foo {args} {track; oninit; return -code error 5}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
# Channel is gone despite error.
note [file channels rc*]
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 5 {}}
-
test iocmd.tf-22.4 {chan finalize, for close, error, close errror} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; error FOO}
+ proc foo {args} {track; oninit; error FOO}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 FOO}
-
test iocmd.tf-22.5 {chan finalize, for close, arbitrary result} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return SOMETHING}
+ proc foo {args} {track; oninit; return SOMETHING}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
note [catch {close $c} msg]; note $msg
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{initialize rc* {read write}} rc* {finalize rc*} 0 {}}
-
test iocmd.tf-22.6 {chan finalize, for close, break, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code 3}
+ proc foo {args} {track; oninit; return -code 3}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
notes
} c]
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 {}} \
-constraints {testchannel testthread}
-
test iocmd.tf-22.7 {chan finalize, for close, continue, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code 4}
+ proc foo {args} {track; oninit; return -code 4}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
notes
} c]
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 {}} \
-constraints {testchannel testthread}
-
test iocmd.tf-22.8 {chan finalize, for close, custom code, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -code 777 BANG}
+ proc foo {args} {track; oninit; return -code 777 BANG}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
- note [catch {close $c} msg] ; note $msg
+ note [catch {close $c} msg]; note $msg
notes
} c]
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 BANG} \
-constraints {testchannel testthread}
-
test iocmd.tf-22.9 {chan finalize, for close, ignore level, close error} -match glob -body {
set res {}
- proc foo {args} {track ; oninit ; return -level 5 -code 777 BANG}
+ proc foo {args} {track; oninit; return -level 5 -code 777 BANG}
note [set c [chan create {r w} foo]]
-
notes [inthread $c {
- note [catch {close $c} msg opt] ; note $msg ; note $opt
+ note [catch {close $c} msg opt]; note $msg; note $opt
notes
} c]
-
rename foo {}
set res
} -result {{initialize rc* {read write}} rc* {finalize rc*} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
@@ -2263,7 +1949,7 @@ test iocmd.tf-22.9 {chan finalize, for close, ignore level, close error} -match
test iocmd.tf-23.1 {chan read, regular data return} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return snarf
}
set c [chan create {r w} foo]
@@ -2272,135 +1958,114 @@ test iocmd.tf-23.1 {chan read, regular data return} -match glob -body {
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{read rc* 4096} {read rc* 4096} snarfsnarf}
-
test iocmd.tf-23.2 {chan read, bad data return, to much} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return [string repeat snarf 1000]
}
set c [chan create {r w} foo]
notes [inthread $c {
- note [catch {[read $c 2]} msg] ; note $msg
+ note [catch {[read $c 2]} msg]; note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{read rc* 4096} 1 {read delivered more than requested}}
-
test iocmd.tf-23.3 {chan read, for non-readable channel} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
- note MUST_NOT_HAPPEN
+ oninit; onfinal; track; note MUST_NOT_HAPPEN
}
set c [chan create {w} foo]
notes [inthread $c {
- note [catch {[read $c 2]} msg] ; note $msg
+ note [catch {[read $c 2]} msg]; note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {1 {channel "rc*" wasn't opened for reading}}
-
test iocmd.tf-23.4 {chan read, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-23.5 {chan read, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code break BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-23.6 {chan read, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-23.7 {chan read, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -code 777 BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {read $c 2} msg] ; note $msg
+ note [catch {read $c 2} msg]; note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-23.8 {chan read, level is squashed} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
return -level 55 -code 777 BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {read $c 2} msg opt] ; note $msg ; note $opt
+ note [catch {read $c 2} msg opt]; note $msg; note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{read rc* 4096} 1 BOOM! {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BOOM!}} \
@@ -2412,216 +2077,181 @@ test iocmd.tf-23.8 {chan read, level is squashed} -match glob -body {
test iocmd.tf-24.1 {chan write, regular write} -match glob -body {
set res {}
proc foo {args} {
- oninit; onfinal ; track
+ oninit; onfinal; track
set written [string length [lindex $args 2]]
note $written
return $written
}
set c [chan create {r w} foo]
-
inthread $c {
- puts -nonewline $c snarf ; flush $c
+ puts -nonewline $c snarf; flush $c
close $c
} c
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{write rc* snarf} 5}
-
test iocmd.tf-24.2 {chan write, ack partial writes} -match glob -body {
set res {}
proc foo {args} {
- oninit ; onfinal ; track
+ oninit; onfinal; track
set written [string length [lindex $args 2]]
if {$written > 10} {set written [expr {$written / 2}]}
note $written
return $written
}
set c [chan create {r w} foo]
-
inthread $c {
- puts -nonewline $c snarfsnarfsnarf ; flush $c
+ puts -nonewline $c snarfsnarfsnarf; flush $c
close $c
} c
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{write rc* snarfsnarfsnarf} 7 {write rc* arfsnarf} 8}
-
test iocmd.tf-24.3 {chan write, failed write} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note -1 ; return -1}
+ proc foo {args} {oninit; onfinal; track; note -1; return -1}
set c [chan create {r w} foo]
-
inthread $c {
- puts -nonewline $c snarfsnarfsnarf ; flush $c
+ puts -nonewline $c snarfsnarfsnarf; flush $c
close $c
} c
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{write rc* snarfsnarfsnarf} -1}
-
test iocmd.tf-24.4 {chan write, non-writable channel} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg] ; note $msg
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {1 {channel "rc*" wasn't opened for writing}}
-
test iocmd.tf-24.5 {chan write, bad result, more written than data} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return 10000}
+ proc foo {args} {oninit; onfinal; track; return 10000}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarf ; flush $c} msg] ; note $msg
+ note [catch {puts -nonewline $c snarf; flush $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{write rc* snarf} 1 {write wrote more than requested}}
-
test iocmd.tf-24.6 {chan write, zero writes} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return 0}
+ proc foo {args} {oninit; onfinal; track; return 0}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarf ; flush $c} msg] ; note $msg
+ note [catch {puts -nonewline $c snarf; flush $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{write rc* snarf} 1 {write wrote more than requested}}
-
test iocmd.tf-24.7 {chan write, failed write, error return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code error BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code error BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-24.8 {chan write, failed write, error return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; error BOOM!}
+ proc foo {args} {oninit; onfinal; track; error BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-24.9 {chan write, failed write, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-24.10 {chan write, failed write, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-24.11 {chan write, failed write, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code 777 BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -code 777 BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-24.12 {chan write, failed write, non-numeric return is error} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return BANG}
+ proc foo {args} {oninit; onfinal; track; return BANG}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg]
note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 {expected integer but got "BANG"}} \
-constraints {testchannel testthread}
-
test iocmd.tf-24.13 {chan write, failed write, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -level 55 -code 777 BOOM!}
+ proc foo {args} {oninit; onfinal; track; return -level 55 -code 777 BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {puts -nonewline $c snarfsnarfsnarf ; flush $c} msg opt]
+ note [catch {puts -nonewline $c snarfsnarfsnarf; flush $c} msg opt]
note $msg
note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{write rc* snarfsnarfsnarf} 1 BOOM! {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BOOM!}} \
@@ -2632,180 +2262,159 @@ test iocmd.tf-24.13 {chan write, failed write, level is ignored} -match glob -bo
test iocmd.tf-25.1 {chan configure, cgetall, standard options} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} \
-result {{-blocking 1 -buffering full -buffersize 4096 -encoding * -eofchar {{} {}} -translation {auto *}}}
-
test iocmd.tf-25.2 {chan configure, cgetall, no options} -match glob -body {
set res {}
- proc foo {args} {oninit cget cgetall ; onfinal ; track ; return ""}
+ proc foo {args} {oninit cget cgetall; onfinal; track; return ""}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} \
-result {{cgetall rc*} {-blocking 1 -buffering full -buffersize 4096 -encoding * -eofchar {{} {}} -translation {auto *}}}
-
test iocmd.tf-25.3 {chan configure, cgetall, regular result} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return "-bar foo -snarf x"
}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} \
-result {{cgetall rc*} {-blocking 1 -buffering full -buffersize 4096 -encoding * -eofchar {{} {}} -translation {auto *} -bar foo -snarf x}}
-
test iocmd.tf-25.4 {chan configure, cgetall, bad result, list of uneven length} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return "-bar"
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{cgetall rc*} 1 {Expected list with even number of elements, got 1 element instead}}
-
test iocmd.tf-25.5 {chan configure, cgetall, bad result, not a list} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return "\{"
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{cgetall rc*} 1 {unmatched open brace in list}}
-
test iocmd.tf-25.6 {chan configure, cgetall, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{cgetall rc*} 1 BOOM!}
-
test iocmd.tf-25.7 {chan configure, cgetall, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code break BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-25.8 {chan configure, cgetall, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-25.9 {chan configure, cgetall, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code 777 BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg] ; note $msg
+ note [catch {fconfigure $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-25.10 {chan configure, cgetall, level is ignored} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -level 55 -code 777 BANG
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c} msg opt]
+ note $msg
+ note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cgetall rc*} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
@@ -2817,125 +2426,110 @@ test iocmd.tf-25.10 {chan configure, cgetall, level is ignored} -match glob -bod
test iocmd.tf-26.1 {chan configure, set standard option} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track ; note MUST_NOT_HAPPEN
- return
+ oninit configure; onfinal; track; note MUST_NOT_HAPPEN; return
}
-
set c [chan create {r w} foo]
notes [inthread $c {
note [fconfigure $c -translation lf]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{}}
-
test iocmd.tf-26.2 {chan configure, set option, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{configure rc* -rc-foo bar} 1 BOOM!}
-
test iocmd.tf-26.3 {chan configure, set option, ok return} -match glob -body {
set res {}
- proc foo {args} {oninit configure ; onfinal ; track ; return}
+ proc foo {args} {oninit configure; onfinal; track; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -rc-foo bar]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{configure rc* -rc-foo bar} {}}
-
test iocmd.tf-26.4 {chan configure, set option, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code break BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-26.5 {chan configure, set option, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-26.6 {chan configure, set option, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -code 444 BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo bar} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo bar} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-26.7 {chan configure, set option, level is ignored} -match glob -body {
set res {}
proc foo {args} {
- oninit configure ; onfinal ; track
+ oninit configure; onfinal; track
return -level 55 -code 444 BANG
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo bar} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c -rc-foo bar} msg opt]
+ note $msg
+ note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{configure rc* -rc-foo bar} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
@@ -2946,108 +2540,97 @@ test iocmd.tf-26.7 {chan configure, set option, level is ignored} -match glob -b
test iocmd.tf-27.1 {chan configure, get option, ok return} -match glob -body {
set res {}
- proc foo {args} {oninit cget cgetall ; onfinal ; track ; return foo}
+ proc foo {args} {oninit cget cgetall; onfinal; track; return foo}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -rc-foo]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{cget rc* -rc-foo} foo}
-
test iocmd.tf-27.2 {chan configure, get option, error return} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{cget rc* -rc-foo} 1 BOOM!}
-
test iocmd.tf-27.3 {chan configure, get option, break return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code error BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-27.4 {chan configure, get option, continue return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code continue BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-27.5 {chan configure, get option, custom return is error} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -code 333 BOOM!
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo} msg] ; note $msg
+ note [catch {fconfigure $c -rc-foo} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-27.6 {chan configure, get option, level is ignored} -match glob -body {
set res {}
proc foo {args} {
- oninit cget cgetall ; onfinal ; track
+ oninit cget cgetall; onfinal; track
return -level 77 -code 333 BANG
}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -rc-foo} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c -rc-foo} msg opt]
+ note $msg
+ note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{cget rc* -rc-foo} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
@@ -3058,308 +2641,269 @@ test iocmd.tf-27.6 {chan configure, get option, level is ignored} -match glob -b
test iocmd.tf-28.1 {chan tell, not supported by handler} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [tell $c]
close $c
notes
} c]
-
rename foo {}
set res
} -result {-1} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.2 {chan tell, error return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code error BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code error BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.3 {chan tell, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.4 {chan tell, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.5 {chan tell, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code 222 BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code 222 BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.6 {chan tell, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -level 11 -code 222 BANG}
+ proc foo {args} {oninit seek; onfinal; track; return -level 11 -code 222 BANG}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg opt] ; note $msg ; note $opt
+ note [catch {tell $c} msg opt]
+ note $msg
+ note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.7 {chan tell, regular return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return 88}
+ proc foo {args} {oninit seek; onfinal; track; return 88}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [tell $c]
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 88} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.8 {chan tell, negative return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -1}
+ proc foo {args} {oninit seek; onfinal; track; return -1}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 {Tried to seek before origin}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.9 {chan tell, string return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return BOGUS}
+ proc foo {args} {oninit seek; onfinal; track; return BOGUS}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {tell $c} msg] ; note $msg
+ note [catch {tell $c} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} 1 {expected integer but got "BOGUS"}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.10 {chan seek, not supported by handler} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {1 {error during seek on "rc*": invalid argument}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.11 {chan seek, error return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code error BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code error BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.12 {chan seek, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.13 {chan seek, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.14 {chan seek, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -code 99 BOOM!}
+ proc foo {args} {oninit seek; onfinal; track; return -code 99 BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.15 {chan seek, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -level 33 -code 99 BANG}
+ proc foo {args} {oninit seek; onfinal; track; return -level 33 -code 99 BANG}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg opt] ; note $msg ; note $opt
+ note [catch {seek $c 0 start} msg opt]
+ note $msg
+ note $opt
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.16 {chan seek, bogus return, negative location} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return -45}
+ proc foo {args} {oninit seek; onfinal; track; return -45}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 {Tried to seek before origin}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.17 {chan seek, bogus return, string return} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return BOGUS}
+ proc foo {args} {oninit seek; onfinal; track; return BOGUS}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {seek $c 0 start} msg] ; note $msg
+ note [catch {seek $c 0 start} msg]
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 start} 1 {expected integer but got "BOGUS"}} \
-constraints {testchannel testthread}
-
test iocmd.tf-28.18 {chan seek, ok result} -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return 23}
+ proc foo {args} {oninit seek; onfinal; track; return 23}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [seek $c 0 current]
close $c
notes
} c]
-
rename foo {}
set res
} -result {{seek rc* 0 current} {}} \
-constraints {testchannel testthread}
-
-foreach {n code} {
- 0 start
- 1 current
- 2 end
+foreach {testname code} {
+ iocmd.tf-28.19.0 start
+ iocmd.tf-28.19.1 current
+ iocmd.tf-28.19.2 end
} {
- test iocmd.tf-28.19.$n "chan seek, base conversion, $code" -match glob -body {
+ test $testname "chan seek, base conversion, $code" -match glob -body {
set res {}
- proc foo {args} {oninit seek ; onfinal ; track ; return 0}
+ proc foo {args} {oninit seek; onfinal; track; return 0}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [seek $c 0 $code]
close $c
notes
} c code]
-
rename foo {}
set res
} -result [list [list seek rc* 0 $code] {}] \
@@ -3371,180 +2915,154 @@ foreach {n code} {
test iocmd.tf-29.1 {chan blocking, no handler support} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -blocking]
close $c
notes
} c]
-
rename foo {}
set res
} -result {1} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.2 {chan blocking, no handler support} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -blocking 0]
note [fconfigure $c -blocking]
close $c
notes
} c]
-
rename foo {}
set res
} -result {{} 0} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.3 {chan blocking, retrieval, handler support} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; note MUST_NOT_HAPPEN ; return}
+ proc foo {args} {oninit blocking; onfinal; track; note MUST_NOT_HAPPEN; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -blocking]
close $c
notes
} c]
-
rename foo {}
set res
} -result {1} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.4 {chan blocking, resetting, handler support} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return}
+ proc foo {args} {oninit blocking; onfinal; track; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -blocking 0]
note [fconfigure $c -blocking]
close $c
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} {} 0} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.5 {chan blocking, setting, handler support} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return}
+ proc foo {args} {oninit blocking; onfinal; track; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fconfigure $c -blocking 1]
note [fconfigure $c -blocking]
close $c
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 1} {} 1} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.6 {chan blocking, error return} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; error BOOM!}
-
+ proc foo {args} {oninit blocking; onfinal; track; error BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
+ note [catch {fconfigure $c -blocking 0} msg]
+ note $msg
# Catch the close. It changes blocking mode internally, and runs into the error result.
catch {close $c}
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.7 {chan blocking, break return is error} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -code break BOOM!}
+ proc foo {args} {oninit blocking; onfinal; track; return -code break BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
+ note [catch {fconfigure $c -blocking 0} msg]
+ note $msg
catch {close $c}
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.8 {chan blocking, continue return is error} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -code continue BOOM!}
+ proc foo {args} {oninit blocking; onfinal; track; return -code continue BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
+ note [catch {fconfigure $c -blocking 0} msg]
+ note $msg
catch {close $c}
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.9 {chan blocking, custom return is error} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -code 44 BOOM!}
+ proc foo {args} {oninit blocking; onfinal; track; return -code 44 BOOM!}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
+ note [catch {fconfigure $c -blocking 0} msg]
+ note $msg
catch {close $c}
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} 1 BOOM!} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.10 {chan blocking, level is ignored} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return -level 99 -code 44 BANG}
+ proc foo {args} {oninit blocking; onfinal; track; return -level 99 -code 44 BANG}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -blocking 0} msg opt] ; note $msg ; note $opt
+ note [catch {fconfigure $c -blocking 0} msg opt]
+ note $msg
+ note $opt
catch {close $c}
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} 1 BANG {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo BANG}} \
-constraints {testchannel testthread}
-
test iocmd.tf-29.11 {chan blocking, regular return ok, value ignored} -match glob -body {
set res {}
- proc foo {args} {oninit blocking ; onfinal ; track ; return BOGUS}
+ proc foo {args} {oninit blocking; onfinal; track; return BOGUS}
set c [chan create {r w} foo]
-
notes [inthread $c {
- note [catch {fconfigure $c -blocking 0} msg] ; note $msg
+ note [catch {fconfigure $c -blocking 0} msg]
+ note $msg
catch {close $c}
notes
} c]
-
rename foo {}
set res
} -result {{blocking rc* 0} 0 {}} \
@@ -3555,40 +3073,33 @@ test iocmd.tf-29.11 {chan blocking, regular return ok, value ignored} -match glo
test iocmd.tf-30.1 {chan watch, read interest, some return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return IGNORED}
+ proc foo {args} {oninit; onfinal; track; return IGNORED}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fileevent $c readable {set tick $tick}]
- close $c ;# 2nd watch, interest zero.
+ close $c ;# 2nd watch, interest zero.
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{watch rc* read} {watch rc* {}} {}}
-
test iocmd.tf-30.2 {chan watch, write interest, error return} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return -code error BOOM!_IGNORED}
+ proc foo {args} {oninit; onfinal; track; return -code error BOOM!_IGNORED}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fileevent $c writable {set tick $tick}]
note [fileevent $c writable {}]
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} -result {{watch rc* write} {watch rc* {}} {} {}}
-
test iocmd.tf-30.3 {chan watch, accumulated interests} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fileevent $c writable {set tick $tick}]
note [fileevent $c readable {set tick $tick}]
@@ -3597,25 +3108,21 @@ test iocmd.tf-30.3 {chan watch, accumulated interests} -match glob -body {
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} \
-result {{watch rc* write} {watch rc* {read write}} {watch rc* read} {watch rc* {}} {} {} {} {}}
-
test iocmd.tf-30.4 {chan watch, unchanged interest not forwarded} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
note [fileevent $c writable {set tick $tick}]
note [fileevent $c readable {set tick $tick}] ;# Script is changing,
note [fileevent $c readable {set tock $tock}] ;# interest does not.
- close $c ;# 3rd and 4th watch, removing the event handlers.
+ close $c ;# 3rd and 4th watch, removing the event handlers.
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} \
@@ -3628,21 +3135,19 @@ test iocmd.tf-30.4 {chan watch, unchanged interest not forwarded} -match glob -b
test iocmd.tf-31.8 {chan postevent, bad input} -match glob -body {
set res {}
- proc foo {args} {oninit ; onfinal ; track ; return}
+ proc foo {args} {oninit; onfinal; track; return}
set c [chan create {r w} foo]
-
notes [inthread $c {
- catch {chan postevent $c r} msg ; note $msg
+ catch {chan postevent $c r} msg
+ note $msg
close $c
notes
} c]
-
rename foo {}
set res
} -constraints {testchannel testthread} \
-result {{postevent for channel "rc*" called from outside interpreter}}
-
# ### ### ### ######### ######### #########
# ### ### ### ######### ######### #########