1# Commands covered: send 2# 3# This file contains a collection of tests for one or more of the Tcl 4# built-in commands. Sourcing this file into Tcl runs the tests and 5# generates output for errors. No output means no errors were found. 6 7if {[lsearch [namespace children] ::tcltest] == -1} { 8 package require tcltest 9 # do this in a way that is backward compatible for Tcl 8.3 10 namespace import ::tcltest::test ::tcltest::cleanupTests 11} 12package require Expect 13 14log_user 0 15 16#exp_internal -f /dev/ttyp5 0 17 18test send-1.1 {basic send operation} { 19 spawn cat 20 after 1000 21 send "foo\r" 22 expect foo 23 after 1000 24 send "\u0004" 25 expect eof 26 regexp "\r\nfoo\r\n" $expect_out(buffer) 27} {1} 28 29test send-1.2 {send null} { 30 spawn od -c 31 send "a\u0000b\r" 32 after 1000 33 send \u0004 34 expect eof 35 regexp "a \\\\0 b" $expect_out(buffer) 36} {1} 37 38cleanupTests 39return 40