diff options
Diffstat (limited to 'tests/tty.test')
-rw-r--r-- | tests/tty.test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/tty.test b/tests/tty.test new file mode 100644 index 0000000..0736947 --- /dev/null +++ b/tests/tty.test @@ -0,0 +1,44 @@ +source [file dirname [info script]]/testing.tcl + +set havetty 0 +catch { + set havetty [expr {"tty" in [stdout -commands]}] +} +if {!$havetty} { + skiptest " (aio tty)" +} + +test tty-1.1 {tty status} { + set dict [stdout tty] + dict exists $dict output +} 1 + +foreach {id param value} { + tty-1.2 output raw + tty-1.3 input raw + tty-1.4 handshake rtscts +} { + test $id "tty setting $param" -setup { + set savetty [stdout tty] + } -body "stdout tty $param $value; dict get \[stdout tty\] $param" \ + -result $value -cleanup { + stdout tty $savetty + } +} + +test tty-1.4 {tty setting} -body { + stdout tty output bad +} -returnCodes error -result {bad value for output: bad} + +test tty-1.4 {tty setting} -body { + stdout tty bad value +} -returnCodes error -result {bad setting "bad": must be baud, data, echo, handshake, input, output, parity, stop, vmin, or vtime} + +test tty-1.5 {tty bad fd} -body { + set f [open [file tempfile] w] + $f tty +} -returnCodes error -result {Inappropriate ioctl for device} -cleanup { + $f close +} + +testreport |