[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 262c91b4867b23f50e683eacbc8163d3b75d752c
Freddy Vulto (none)
freddy at rebase.
Fri Jul 10 21:10:35 UTC 2009
The following commit has been merged in the master branch:
commit 262c91b4867b23f50e683eacbc8163d3b75d752c
Author: Freddy Vulto <freddy at rebase.(none)>
Date: Fri Jul 10 23:08:11 2009 +0200
[testsuite] Improved `match_items()' sorting
`match_items()' now uses bash sort instead of tcl lsort.
The difference in sorting happens because bash and tcl use a different sorting order:
* bash sort uses the current locale's collating sequence and character set
* tcl lsort uses a C-like sort order where each character is sorted according to its numeric value
See also: http://fvue.nl/wiki/Tcl:_Lsort_output_differs_from_bash_sort
This fix allows the `dpkg -L' test to compare all packages. To run the test:
./runCompletion dpkg.exp
diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp
index fe6d1c1..ff4c527 100644
--- a/test/lib/completions/dpkg.exp
+++ b/test/lib/completions/dpkg.exp
@@ -21,14 +21,12 @@ sync_after_int
# NOTE: If an argument is passed to `--get-selections', `dpkg' also returns
# packages with status "purged". Be sure to add `| grep install$' to
# pipeline before 'cut' in that case. -- FVu, Sun Feb 22 10:08:34 CET 2009
- # TODO: Fix sorting in `match_items' in lib/library.exp. Sorting in tcl appears
- # to be different from sorting in bash.
-#if {[assert_exec {dpkg --get-selections | cut -f1 | sort} packages]} {
-# assert_complete $packages "dpkg -L "
-#}; # if
-#
-#
-#sync_after_int
+if {[assert_exec {dpkg --get-selections | cut -f1} packages]} {
+ assert_complete $packages "dpkg -L "
+}; # if
+
+
+sync_after_int
teardown
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 7147980..352d892 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -231,7 +231,7 @@ proc get_hosts {} {
# @param integer $size Chunk size
# @result boolean True if successful, False if not
proc match_items {items test {size 20}} {
- set items [lsort -ascii $items]
+ 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