1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
# -*- tcl -*-
# Commands covered: null
#
# This file contains a collection of tests for one or more of the commands
# the Memchan extension. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1999 Andreas Kupries (a.kupries@westend.com)
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: null.test,v 1.2 2004/06/04 14:09:11 patthoyts Exp $
test null-basic-1.0 {Create null devices} {
set chan [null]
close $chan
regsub -all {[0-9]} $chan {} chan
set chan
} {null}
test null-basic-1.1 {Check tell on null devices} {
set chan [null]
set res [tell $chan]
close $chan
set res
} {-1}
test null-basic-1.2 {Check seek on null devices} {
set chan [null]
catch {seek $chan 0} res
close $chan
regsub -all $chan $res XXX res
set res
} {error during seek on "XXX": invalid argument}
test null-rw-1.0 {Write, length and tell} {
set chan [null]
puts -nonewline $chan {hello world}
set res [tell $chan]
close $chan
set res
} {-1}
test null-rw-1.1 {Write and read} {
set chan [null]
puts -nonewline $chan {hello world!}
set res [tell $chan]
lappend res [read $chan]
close $chan
set res
} {-1 {}}
test null-1.5 {presence of -delay option} {
list [catch {
set chan [null]
set res [lsearch -exact [fconfigure $chan] -delay]
close $chan
set res [expr {$res != -1}]
} msg] $msg
} {0 1}
test null-1.6 {read -delay option} {
list [catch {
set chan [null]
set res [fconfigure $chan -delay]
close $chan
set res
} msg] $msg
} {0 5}
test null-1.7 {change -delay option} {
list [catch {
set chan [null]
set res [fconfigure $chan -delay 1000]
lappend res [fconfigure $chan -delay]
close $chan
set res
} msg] $msg
} {0 {1000 1000}}
|