(testsuite) Moved location of making-list-unique
Moved making-expected-list-unique out of `match_items()' & `get_hosts()' into `assert_complete()' because the former are low level functions and items need not necessarily be unique. They only need to be unique when we're actually testing *completions*.
This commit is contained in:
parent
8c94bf6944
commit
a9717be57b
@ -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" }
|
||||
|
@ -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 ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user