summaryrefslogtreecommitdiffstats
path: root/tests/chan.test
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2008-07-21 21:02:11 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2008-07-21 21:02:11 (GMT)
commit4ca6151924c3e7338fb1cdca30d81430477673f8 (patch)
tree5a49a31553d209c8b45882a0b0716544c8bf918e /tests/chan.test
parent24289b9502c809549472c1edc7398415f51f578e (diff)
downloadtcl-4ca6151924c3e7338fb1cdca30d81430477673f8.zip
tcl-4ca6151924c3e7338fb1cdca30d81430477673f8.tar.gz
tcl-4ca6151924c3e7338fb1cdca30d81430477673f8.tar.bz2
TIP #304 implementation
Diffstat (limited to 'tests/chan.test')
-rw-r--r--tests/chan.test38
1 files changed, 36 insertions, 2 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