diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-01-01 16:22:28 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-01-01 16:22:28 +0000 |
commit | cd7dcfb681c22112ff4ac0f9c0fc1a22f9329263 (patch) | |
tree | 97dfa02c20f8020b3ad9db08e66ed9ca426d0b97 /imap4d | |
parent | 3bfd165d3ff81fc8c10c663e44edb8fdac56e9da (diff) | |
download | mailutils-cd7dcfb681c22112ff4ac0f9c0fc1a22f9329263.tar.gz mailutils-cd7dcfb681c22112ff4ac0f9c0fc1a22f9329263.tar.bz2 |
(imap4d_test): New flag -sort toggles on sorting of untagged responces.
Notice that -sort and -re are mutually exclusive.
Diffstat (limited to 'imap4d')
-rw-r--r-- | imap4d/testsuite/lib/imap4d.exp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/imap4d/testsuite/lib/imap4d.exp b/imap4d/testsuite/lib/imap4d.exp index 5afe31fd1..8f631288f 100644 --- a/imap4d/testsuite/lib/imap4d.exp +++ b/imap4d/testsuite/lib/imap4d.exp @@ -1,6 +1,6 @@ # -*- tcl -*- # This file is part of Mailutils testsuite. -# Copyright (C) 2002, Free Software Foundation +# Copyright (C) 2002, 2005, Free Software Foundation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -183,7 +183,7 @@ proc imap4d_auth {args} { } } -# imap4d_test [-message MESSAGE][-default (FAIL|XFAIL)][-long][-silent] +# imap4d_test [-message MESSAGE][-default (FAIL|XFAIL)][-long][-silent][-sort] # COMMAND [UNTAGGED...][TAGGED] # COMMAND - Command to send. # UNTAGGED - A list of untagged responses to expect in return. @@ -192,11 +192,12 @@ proc imap4d_auth {args} { proc imap4d_test {args} { global IMAP4D_TAG global verbose - + set default "" set message "" set long 0 set silent 0 + set sort 0 for {set i 0} {$i < [llength $args]} {incr i} { set a [lindex $args $i] if {"$a" == "-default"} { @@ -209,6 +210,8 @@ proc imap4d_test {args} { set long 1 } elseif {"$a" == "-silent"} { set silent 1 + } elseif {"$a" == "-sort"} { + set sort 1 } else { set args [lrange $args $i end] break @@ -263,6 +266,7 @@ proc imap4d_test {args} { set tagged "OK" } + verbose "TAGGED $tagged" if {$long} { set command "$command {[string length $command_data]}" imap4d_command $command @@ -282,6 +286,37 @@ proc imap4d_test {args} { set s [split $command_data "\n"] set s [lrange $s 0 [expr [llength $s] - 2]] set result [mu_expect_list 360 [concat $s $pattern]] + } elseif {$sort && [llength $pattern] > 0} { + set command [imap4d_make_command $command] + set result [mu_test $command [list "-re" "(.*)\n$IMAP4D_TAG $tagged"]] + if {$result == 0} { + if [info exists expect_out(1,string)] { + set out [lsort -ascii [split $expect_out(1,string) "\n"]] + set in [lsort -ascii $pattern] + if {[llength $in] == [llength $out]} { + for {set i 0} {$i < [llength $in]} {incr i} { + regexp "(\[^\r\]*)" [lindex $out $i] dummy tmp + if [string compare [lindex $in $i] $tmp] { + verbose "Item $i comparison failed" + set result 1 + break + } + } + } else { + verbose "Input and output lists have different lengths" + set result 1 + } + + if {$result} { + verbose "Input: $in" + verbose "Output: $out" + } + + } else { + verbose "expect_out(1,string) does not exist. Buffer: $expect_out(buffer)" + set result 1 + } + } } else { set command [imap4d_make_command $command] set pattern [concat $pattern [list "$IMAP4D_TAG $tagged"]] |