diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-04-17 16:23:37 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-04-17 17:36:50 +1000 |
commit | b081ba9fe23cb52fbd17a7f4635244c9ce3ff1fa (patch) | |
tree | 3f32b3f3d0fac917ef15817e726617f86d1fce6c /tests/tty.test | |
parent | 35b0acdccfe58043717b026fa2d86ecd76711c85 (diff) | |
download | jimtcl-b081ba9fe23cb52fbd17a7f4635244c9ce3ff1fa.zip jimtcl-b081ba9fe23cb52fbd17a7f4635244c9ce3ff1fa.tar.gz jimtcl-b081ba9fe23cb52fbd17a7f4635244c9ce3ff1fa.tar.bz2 |
tests: improve code coverage
- clock
- array
- file tempfile
- lreverse
- string byterange
- aio tty
Signed-off-by: Steve Bennett <steveb@workware.net.au>
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 |