summaryrefslogtreecommitdiff
path: root/expect/tests/pid.test
diff options
context:
space:
mode:
Diffstat (limited to 'expect/tests/pid.test')
-rw-r--r--expect/tests/pid.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/expect/tests/pid.test b/expect/tests/pid.test
new file mode 100644
index 00000000000..76167e30986
--- /dev/null
+++ b/expect/tests/pid.test
@@ -0,0 +1,36 @@
+# Commands covered: pid
+#
+# 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 {[string compare test [info procs test]] == 1} then {source defs}
+
+catch {unset x}
+
+#exp_internal -f /dev/ttyp5 0
+
+test pid-1.2 {basic pid operation} {
+ set cat [exp_spawn -noecho cat]
+ set x [expr 0!=$cat]
+ set y [expr 0==[string compare $cat [exp_pid -i $spawn_id]]]
+ exp_close;exp_wait
+ list $x $y
+} {1 1}
+
+test pid-1.3 {basic pid operation} {
+ exp_spawn -noecho cat; set cat $spawn_id
+ exp_spawn -noecho cat; set cat2 $spawn_id
+ set x [expr {0!=[string compare [exp_pid -i $cat2] [exp_pid -i $cat]]}]
+ exp_close -i $cat;exp_wait -i $cat;exp_close -i $cat2;exp_wait -i $cat2
+ set x
+} {1}
+
+test pid-1.4 {basic pid operation} {
+ list [catch {exp_pid -i 100} msg] $msg
+} {1 {exp_pid: invalid spawn id (100)}}
+
+test pid-1.5 {basic pid operation} {
+ list [catch {exp_pid -j} msg] $msg
+} {1 {usage: -i spawn_id}}
+