diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/chan.test | 38 | ||||
-rw-r--r-- | tests/ioCmd.test | 11 | ||||
-rw-r--r-- | tests/ioTrans.test | 11 |
3 files changed, 46 insertions, 14 deletions
diff --git a/tests/chan.test b/tests/chan.test index b047883..39dd111 100644 --- a/tests/chan.test +++ b/tests/chan.test @@ -7,7 +7,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: chan.test,v 1.14 2008/07/19 22:50:38 nijtmans Exp $ +# RCS: @(#) $Id: chan.test,v 1.15 2008/07/21 21:02:19 ferrieux Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -24,7 +24,7 @@ test chan-1.1 {chan command general syntax} -body { } -returnCodes error -result "wrong # args: should be \"chan subcommand ?arg ...?\"" test chan-1.2 {chan command general syntax} -body { chan FOOBAR -} -returnCodes error -result "unknown or ambiguous subcommand \"FOOBAR\": must be blocked, close, configure, copy, create, eof, event, flush, gets, names, pending, pop, postevent, push, puts, read, seek, tell, or truncate" +} -returnCodes error -match glob -result "unknown or ambiguous subcommand \"FOOBAR\": must be *" test chan-2.1 {chan command: blocked subcommand} -body { chan blocked foo bar @@ -223,6 +223,40 @@ test chan-16.13 {chan command: pending output subcommand} -setup { catch {removeFile $file} } +# TIP 304: chan pipe + +test chan-17.1 {chan command: pipe subcommand} -body { + chan pipe foo +} -returnCodes error -result "wrong # args: should be \"chan pipe \"" + +test chan-17.2 {chan command: pipe subcommand} -body { + chan pipe foo bar +} -returnCodes error -result "wrong # args: should be \"chan pipe \"" + +test chan-17.3 {chan command: pipe subcommand} -body { + set l [chan pipe] + foreach {pr pw} $l break + list [llength $l] [fconfigure $pr -blocking] [fconfigure $pw -blocking] +} -result [list 2 1 1] -cleanup { + close $pw + close $pr +} + +test chan-17.4 {chan command: pipe subcommand} -body { + set ::done 0 + foreach {::pr ::pw} [chan pipe] break + after 100 {puts $::pw foo;flush $::pw} + fileevent $::pr readable {set ::done 1} + after 500 {set ::done -1} + vwait ::done + set out nope + if {$::done==1} {gets $::pr out} + list $::done $out +} -result [list 1 foo] -cleanup { + close $::pw + close $::pr +} + cleanupTests return diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 9648843..101f2fb 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -13,7 +13,7 @@ # 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.45 2008/07/19 22:50:38 nijtmans Exp $ +# RCS: @(#) $Id: ioCmd.test,v 1.46 2008/07/21 21:02:19 ferrieux Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -637,11 +637,10 @@ close $wfile test iocmd-20.0 {chan, wrong#args} { catch {chan} msg set msg -} {wrong # args: should be "chan subcommand ?arg ...?"} -test iocmd-20.1 {chan, unknown method} { - catch {chan foo} msg - set msg -} {unknown or ambiguous subcommand "foo": must be blocked, close, configure, copy, create, eof, event, flush, gets, names, pending, pop, postevent, push, puts, read, seek, tell, or truncate} +} {wrong # args: should be "chan subcommand ?argument ...?"} +test iocmd-20.1 {chan, unknown method} -body { + chan foo +} -returnCodes error -match glob -result {unknown or ambiguous subcommand "foo": must be *} # --- --- --- --------- --------- --------- # chan create, and method "initalize" diff --git a/tests/ioTrans.test b/tests/ioTrans.test index e7c7d72..1b329c3 100644 --- a/tests/ioTrans.test +++ b/tests/ioTrans.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: ioTrans.test,v 1.5 2008/07/19 22:50:39 nijtmans Exp $ +# RCS: @(#) $Id: ioTrans.test,v 1.6 2008/07/21 21:02:20 ferrieux Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -115,11 +115,10 @@ eval $helperscript test iortrans-1.0 {chan, wrong#args} { catch {chan} msg set msg -} {wrong # args: should be "chan subcommand ?arg ...?"} -test iortrans-1.1 {chan, unknown method} { - catch {chan foo} msg - set msg -} {unknown or ambiguous subcommand "foo": must be blocked, close, configure, copy, create, eof, event, flush, gets, names, pending, pop, postevent, push, puts, read, seek, tell, or truncate} +} {wrong # args: should be "chan subcommand ?argument ...?"} +test iortrans-1.1 {chan, unknown method} -body { + chan foo +} -returnCodes error -match glob -result {unknown or ambiguous subcommand "foo": must be*} # --- --- --- --------- --------- --------- # chan push, and method "initalize" |