Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
3a539644
...
3a5396445e68af006667f96b89a529c914d2028d
authored
2002-08-26 17:10:05 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mu_expect_list): New procedure
1 parent
dd4127fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
11 deletions
testsuite/lib/mailutils.exp
testsuite/lib/mailutils.exp
View file @
3a53964
...
...
@@ -211,7 +211,8 @@ proc mu_expect { args } {
}
}
verbose
"RUNNING remote_expect host
$gtimeout
$notransfer
$expcode
"
2
verbose
"EXPCODE is
$expcode
"
4
verbose
"RUNNING remote_expect host
$gtimeout
$notransfer
"
2
set code
[
catch
\
{
uplevel
remote_expect host
$gtimeout
$notransfer
$expcode
}
string
];
...
...
@@ -236,6 +237,74 @@ proc mu_expect { args } {
}
}
proc
mu_expect_list
{
args
}
{
set tmt
[
lindex
$args
0
]
set pattern
[
lindex
$args
1
]
set result 0
for
{
set
i 0
}
{
$i
<
[
llength
$pattern
]}
{
incr
i
}
{
set regexp 0
switch -regexp --
"
[
lindex
${pattern}
$i
]
"
{
^-re.*$
{
set regexp 1
;
incr i
}
^--
{
incr i
}
}
regsub
"
\[
\t\]
*
$
"
[
lindex
${pattern}
$i
]
""
pat
verbose
"i=
$i
, pat=
$pat
"
2
if
{
$regexp
}
{
verbose
"REGEX for
$pat
/
[
llength
$pat
]
"
3
mu_expect
$tmt
{
-re
$pat
{
}
default
{
set result 1
break
}
timeout
{
set result -2
break
}
eof
{
set result -3
break
}
}
}
else
{
mu_expect
$tmt
{
-ex
"
$pat
"
{
if
{
$expect
_out
(
buffer
)
!=
$expect
_out
(
0,string
)
}
{
verbose
"Got
\"
$expect
_out(buffer)
\"
"
2
verbose
"instead of expected
\"
$pat
\\
r
\\
n
\"
"
2
set result 1
break
}
}
default
{
set result 1
break
}
timeout
{
set result -2
break
}
eof
{
set result -3
break
}
}
}
if
{
$result
== 0
}
{
mu_expect
$tmt
{
-re
"
\[
\t
]*
\r\n
"
{
}
default
{
set result 1
}
timeout
{
set result -2
}
eof
{
set result -3
}
}
}
}
return
$result
}
# mu_test COMMAND PATTERN
# COMMAND - Command to send to mail
# PATTERN - A list of strings to expect in return
...
...
@@ -290,7 +359,7 @@ proc mu_test { args } {
set regexp 0
switch -regexp --
"
[
lindex
${pattern}
$i
]
"
{
^-re.*$
{
set regexp 1
;
incr i
}
^--
{
incr i
}
^--
{
incr i
}
}
regsub
"
\[
\t\]
*
$
"
[
lindex
${pattern}
$i
]
""
pat
...
...
@@ -299,7 +368,7 @@ proc mu_test { args } {
if
{
$regexp
}
{
verbose
"REGEX for
$pat
/
[
llength
$pat
]
"
3
mu_expect
$tmt
{
-re
$pat
{
}
-re
"
$pat
\[
\r\t\]
*
\r\n
"
{
}
default
{
set result 1
break
...
...
@@ -336,15 +405,15 @@ proc mu_test { args } {
break
}
}
if
{
$result
== 0
}
{
mu_expect
$tmt
{
-re
"
\[
\t
]*
\r\n
"
{
}
default
{
set result 1
}
timeout
{
set result -2
}
eof
{
set result -3
}
}
}
}
if
{
$result
== 0
}
{
mu_expect
$tmt
{
-re
"
\[
\t
]*
\r\n
"
{
}
default
{
set result 1
}
timeout
{
set result -2
}
eof
{
set result -3
}
}
}
}
return
$result
}
...
...
Please
register
or
sign in
to post a comment