diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp index 5388383e..dd69db3f 100644 --- a/test/lib/completions/scp.exp +++ b/test/lib/completions/scp.exp @@ -101,7 +101,7 @@ assert_bash_exec "cd $dir" "" $prompt set cmd "scp -F 'spaced conf' " send "$cmd\t" expect -ex "$cmd\r\n" -if {[match_items $expected $test]} { +if {[match_items [lsort -unique $expected] $test]} { expect { -re $prompt { pass "$test" } -re eof { unresolved "eof" } diff --git a/test/lib/library.exp b/test/lib/library.exp index ea8a1a7d..38325500 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -127,6 +127,8 @@ proc assert_complete {expected cmd {test ""} {prompt /@} {size 20} {cword ""}} { }; # if } else { expect -ex "$cmd\r\n" + # Make sure expected items are unique + set expected [lsort -unique $expected] }; # if if {[match_items $expected $test]} { @@ -371,7 +373,7 @@ proc get_hosts {} { if {[llength $avahi_hosts] > 0} { lappend hosts $avahi_hosts }; # if - return [lsort -unique $hosts] + return $hosts }; # get_hosts() @@ -416,7 +418,9 @@ proc get_signals {} { # @param integer $size Chunk size # @result boolean True if successful, False if not proc match_items {items test {size 20}} { - set items [exec sort | uniq << [join $items "\n"]] + # NOTE: `exec sort' is used instead of `lsort' to achieve exactly the + # same sort order as in bash -- FVu, Wed Nov 25 22:25:28 CET 2009 + set items [exec sort << [join $items "\n"]] set result false for {set i 0} {$i < [llength $items]} {set i [expr {$i + $size}]} { set expected ""