OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [expect/] [tests/] [expect.test] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Commands covered:  cat (UNIX), expect
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
 
7
if {[string compare test [info procs test]] == 1} then {source defs}
8
 
9
catch {unset x}
10
 
11
log_user 0
12
 
13
exp_spawn cat -u
14
exp_stty -echo < $spawn_out(slave,name)
15
 
16
test expect-1.1 {exact pattern} {
17
        expect "*"
18
        exp_send "a\r"
19
 
20
        set timeout 10
21
        set x 0
22
        expect -ex a {set x 1}
23
        set x
24
} {1}
25
 
26
test expect-1.2 {exact pattern buffering} {
27
        expect "*"
28
        exp_send "hiahi\r"
29
 
30
        set timeout 10
31
        set x 0
32
        expect -ex hi
33
        expect -ex hi {set x 1}
34
        set x
35
} {1}
36
 
37
# if only this test fails, then configure has guessed incorrectly and
38
# stty accesses the control terminal from stdout.  The quick fix is
39
# to edit expect_cf.h and define STTY_READS_STDOUT to 1.  (It should
40
# be commented out.)  If you figure out a way to fix the configure test,
41
# let me know.  Else, let me know a way to test for your particular
42
# machine and os version so it can be hardwired.
43
test expect-1.3 {exact pattern failure} {
44
        expect "*"
45
        exp_send "hiahi\r"
46
 
47
        set timeout 10
48
        set x 0
49
        expect -ex hi {set x 1}
50
        expect -ex hi {set x 2}
51
        expect -ex hi {set x 3}
52
        set x
53
} {2}
54
 
55
test expect-1.4 {glob pattern} {
56
        expect "*"
57
        exp_send "a\r"
58
 
59
        set timeout 10
60
        set x 0
61
        expect "a" {set x 1}
62
        set x
63
} {1}
64
 
65
test expect-1.5 {glob pattern buffering} {
66
        expect "*"
67
        exp_send "a\r"
68
 
69
        set timeout 10
70
        set x 0
71
        expect "*" {set x 1}
72
        set x
73
} {1}
74
 
75
test expect-1.6 {glob buffer} {
76
        expect "*"
77
        exp_send "philosophic\r"
78
 
79
        set timeout 10
80
        set x 0
81
        expect "hi"
82
        set x [string match *phi $expect_out(buffer)]
83
} {1}
84
 
85
test expect-1.7 {glob string} {
86
        expect "*"
87
        exp_send "philosophic\r"
88
 
89
        set timeout 10
90
        set x 0
91
        expect "hi"
92
        set expect_out(0,string)
93
} {hi}
94
 
95
close
96
wait

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.