Commit fb7da64e authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(good_bad_expect): New proc.

parent 5d810b9b
......@@ -204,6 +204,54 @@ proc simple_expect {regex {testname ""} {is_meta ""}} {
unset test
}
proc good_bad_expect {good_regex bad_regex {xreason ""}} {
global test
global any
global nl
global line_leader
global meta_line_leader
global verbose
if { $verbose } {
puts -nonewline "."
flush stdout
}
set ll $line_leader
if {![regexp "^(\[=%\])(\[0-9\]*)(( )(..*))?$" "$good_regex" all first refno]} {
fail "$test (broken good regex)"
unset test
return
}
set bad_regex "[string range "$bad_regex" 0 0]$refno [string range "$bad_regex" 1 end]"
set test "looking for $good_regex (or $bad_regex)"
expect {
-re "^${ll}($good_regex)$nl" {
if {$xreason != ""} {
setup_xfail "*-*-*" "$xreason"
}
pass "$test (got $expect_out(1,string))"
}
-re "^$ll$bad_regex$nl" {
if {$xreason != ""} {
setup_xfail "*-*-*" "$xreason"
}
fail "$test (bad regex matches)"
}
-re "^${ll}(\[=%\]$refno $any*)$nl" {
fail "$test (unexpected reply $expect_out(1,string))"
}
timeout {fail "$test (timeout)"}
eof {fail "$test (eof)"; wait}
buffer_full {fail "$test (buffer_full)"}
}
unset test
}
proc extracting_expect {regex var grp} {
global test
global any
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment