[Bash-completion-commits] [SCM] bash-completion branch, master, updated. a9717be57be84ab17bc87b126b01642c76315b65
Freddy Vulto
fvulto at gmail.com
Wed Nov 25 21:34:15 UTC 2009
The following commit has been merged in the master branch:
commit a9717be57be84ab17bc87b126b01642c76315b65
Author: Freddy Vulto <fvulto at gmail.com>
Date: Wed Nov 25 22:31:29 2009 +0100
(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*.
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index 5388383..dd69db3 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 ea8a1a7..3832550 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 ""
--
bash-completion
More information about the Bash-completion-commits
mailing list