[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 8daa291d6aee2dc089783926b8ea3f11c90ec296

Freddy Vulto fvulto at gmail.com
Wed Nov 3 21:02:30 UTC 2010


The following commit has been merged in the master branch:
commit 8daa291d6aee2dc089783926b8ea3f11c90ec296
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Wed Nov 3 22:00:12 2010 +0100

    Split test in two for ls.exp, expanding ~part
    Depending on if user has or hasn't an existing home dir, the test should
    respond differently, but it's useful if both tests execute.

diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp
index a7537dc..fb89752 100644
--- a/test/lib/completions/ls.exp
+++ b/test/lib/completions/ls.exp
@@ -19,12 +19,25 @@ if {[assert_exec {ls --help} "" "" "unsupported"]} {
 sync_after_int
 
 
-set test "~part should complete to ~full"
-assert_bash_exec {compgen -u} {} /@ users
+set test "~part should complete to ~full/"
+# Create list of users, having a home dir
+assert_bash_exec {for u in $(compgen -u); do \
+    eval test -d ~$u && echo $u; unset u; done} {} /@ users
 find_unique_completion_pair $users part full
 # If home directory exists, append slash "/", else space " "
-set trail [expr {[llength [glob -nocomplain ~$full]] ? "/" : " "}]
-assert_complete "~$full$trail" "ls ~$part" $test
+assert_complete "~$full/" "ls ~$part" $test
+
+
+sync_after_int
+
+
+set test "~part should complete to ~full<space>"
+# Create list of users, having non-existing home dir
+assert_bash_exec {for u in $(compgen -u); do \
+    eval test -d ~$u || echo $u; unset u; done} {} /@ users
+find_unique_completion_pair $users part full
+# If home directory exists, append slash "/", else space " "
+assert_complete "~$full " "ls ~$part" $test
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list