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
|
# Commands covered: send
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
# do this in a way that is backward compatible for Tcl 8.3
namespace import ::tcltest::test ::tcltest::cleanupTests
}
load [lindex [glob libexpect*.so] 0]
log_user 0
#exp_internal -f /dev/ttyp5 0
test send-1.1 {basic send operation} {
spawn cat
after 1000
send "foo\r"
expect foo
after 1000
send "\u0004"
expect eof
regexp "\r\nfoo\r\n" $expect_out(buffer)
} {1}
test send-1.2 {send null} {
spawn od -c
send "a\u0000b\r"
after 1000
send \u0004
expect eof
regexp "a \\\\0 b" $expect_out(buffer)
} {1}
cleanupTests
return
|