diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-06-06 23:45:37 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-06-06 23:45:37 (GMT) |
commit | e9429305435f6edac06ba3dc914e5658705e160a (patch) | |
tree | 374c84c5df35cf33d6fe30319969eb01c100c078 /tests | |
parent | 6580b2352407aa1b0f314552899f301558bc3113 (diff) | |
download | tcl-e9429305435f6edac06ba3dc914e5658705e160a.zip tcl-e9429305435f6edac06ba3dc914e5658705e160a.tar.gz tcl-e9429305435f6edac06ba3dc914e5658705e160a.tar.bz2 |
TIP#208 implementation
It's crude (especially in the tests and docs department) and incomplete (no truncation on non-POSIX platforms).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/chan.test | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/chan.test b/tests/chan.test new file mode 100644 index 0000000..ae866bd --- /dev/null +++ b/tests/chan.test @@ -0,0 +1,85 @@ +# This file contains a collection of tests for the Tcl built-in 'chan' +# command. Sourcing this file into Tcl runs the tests and generates +# output for errors. No output means no errors were found. +# +# Copyright (c) 2005 Donal K. Fellows +# +# 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.1 2005/06/06 23:45:46 dkf Exp $ + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import -force ::tcltest::* +} + +test chan-1.1 {chan command general syntax} -body { + chan +} -returnCodes error -result "wrong # args: should be \"chan subcommand ...\"" +test chan-1.2 {chan command general syntax} -body { + chan FOOBAR +} -returnCodes error -result "unknown or ambiguous command \"FOOBAR\": should be one of blocked, close, configure, copy, eof, event, flush, gets, names, puts, read, seek, tell, and truncate" + +test chan-2.1 {chan command: blocked subcommand} -body { + chan blocked foo bar +} -returnCodes error -result "wrong # args: should be \"chan blocked channelId\"" + +test chan-3.1 {chan command: close subcommand} -body { + chan close foo bar +} -returnCodes error -result "wrong # args: should be \"chan close channelId\"" + +test chan-4.1 {chan command: configure subcommand} -body { + chan blocked +} -returnCodes error -result "wrong # args: should be \"chan configure channelId ?optionName? ?value? ?optionName value?...\"" + +test chan-5.1 {chan command: copy subcommand} -body { + chan copy foo +} -returnCodes error -result "wrong # args: should be \"chan copy input output ?-size size? ?-command callback?\"" + +test chan-6.1 {chan command: eof subcommand} -body { + chan eof foo bar +} -returnCodes error -result "wrong # args: should be \"chan eof channelId\"" + +test chan-7.1 {chan command: event subcommand} -body { + chan event foo +} -returnCodes error -result "wrong # args: should be \"chan event channelId mode ?script?\"" + +test chan-8.1 {chan command: flush subcommand} -body { + chan flush foo bar +} -returnCodes error -result "wrong # args: should be \"chan flush channelId\"" + +test chan-9.1 {chan command: gets subcommand} -body { + chan gets +} -returnCodes error -result "wrong # args: should be \"chan gets channelId ?varName?\"" + +test chan-10.1 {chan command: names subcommand} -body { + chan names foo bar +} -returnCodes error -result "wrong # args: should be \"chan names ?pattern?\"" + +test chan-11.1 {chan command: puts subcommand} -body { + chan puts foo bar foo bar +} -returnCodes error -result "wrong # args: should be \"chan puts ?-nonewline? ?channelId? string\"" + +test chan-12.1 {chan command: read subcommand} -body { + chan read foo bar +} -returnCodes error -result "wrong # args: should be \"chan read channelId ?numChars?\" or \"chan read ?-nonewline? channelId\"" + +test chan-13.1 {chan command: seek subcommand} -body { + chan seek foo bar foo bar +} -returnCodes error -result "wrong # args: should be \"chan seek channelId offset ?origin?\"" + +test chan-14.1 {chan command: tell subcommand} -body { + chan tell foo bar +} -returnCodes error -result "wrong # args: should be \"chan tell channelId\"" + +test chan-15.1 {chan command: truncate subcommand} -body { + chan truncate foo bar foo bar +} -returnCodes error -result "wrong \# args: should be \"chan truncate channelId ?length?\"" + +cleanupTests +return + +# Local Variables: +# mode: tcl +# End: |