source: sans/utils/bt5/icpgui/test3 @ 88

Last change on this file since 88 was 73, checked in by ajj, 16 years ago

Adding inital test code using expectk

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/expectk
2
3log_user 0
4eval spawn -noecho "/usr/local/icp/bin/icp"
5set icpid $spawn_id
6text .icp
7text .out
8entry .input -relief sunken -bd 1
9button .howlongbut -text "Howlong i1-6" -command {exp_send -i $icpid "howlong i1-6\r"}
10
11pack .icp -fill x -anchor nw -expand true
12pack .input -fill x
13pack .howlongbut
14pack .out -fill x -anchor nw -expand true
15
16
17expect_background {
18        -i $icpid -re "( I \[^\r]+)\r\n" {
19                #regexp {.+\:.+([0-9].+) Mins.+\=.+([0-9].+\.[0-9].+) Hrs.*} $expect_out(1,string) ignore indiv total
20                regexp ".+(\[0-9]+).+(\[0-9]+).+Mins.+(\[0-9]+\.\[0-9]+).+Hrs.*" $expect_out(1,string) ignore ibuf indiv total
21                .out insert end "Howlong = $indiv / $total \n"
22                .icp insert end $expect_out(1,string)
23                .icp insert end "\n"
24        }
25        -i $icpid -re "\[^\x0d]+" {
26                .icp insert end $expect_out(0,string)
27        }
28        -i $any_spawn_id "\x0d" {
29        }
30        -i $any_spawn_id "exit" { exit 0 }
31}
32
33foreach event {<KeyPress> <<PasteSelection>>} {bind .icp $event break; bind .out $event break}
34bind .input <Any-Enter> {focus %W}
35bind .input <Key-Return> {exp_send -i $icpid [ .input get]; exp_send -i $icpid "\r"; .input delete 0 end }
Note: See TracBrowser for help on using the repository browser.