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

Freddy Vulto fvulto at gmail.com
Thu Dec 24 08:44:55 UTC 2009


The following commit has been merged in the master branch:
commit f9db6abdc1743d81c77e0b3eb051e3b69017f315
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Thu Dec 24 09:43:24 2009 +0100

    (testsuite) Added shell script `run'
    This allows tab-completion of test scripts to run, e.g.:
    
        $ ./run unit/comp<TAB>
        $ ./run unit/compgen.exp
    
    Instead of the old way:
    
        $ ./runUnit compgen.exp

diff --git a/test/run b/test/run
new file mode 100755
index 0000000..408c33a
--- /dev/null
+++ b/test/run
@@ -0,0 +1,31 @@
+#!/bin/bash
+# Run test of specified tool.
+# The first directory of the first file (first argument ending with .exp) is
+# used as the `tool' specification.
+# Usage: ./run [FILE]...
+# Example run: ./run unit/_get_cword.exp unit/compgen.exp
+
+
+# Process arguments
+# @param $1  Name of variable to return `tool' name
+# @param $2  Name of variable to return processed arguments
+# @param $@  Arguments to process
+process_args() {
+    local arg
+    for arg in "${@:3}"; do
+        case "$arg" in
+            completion/*.exp|unit/*.exp)
+                [[ ${!1} ]] || printf -v $1 "${arg%%/*}"
+                eval $2[\${#$2[@]}]=\""${arg#*/}"\"
+                ;;
+            *)
+                eval $2[\${#$2[@]}]=\""$arg"\"
+        esac
+    done
+}
+
+args=()
+process_args tool args "$@"
+runtest --outdir log --tool $tool "${args[@]}" 
+
+unset -v args tool

-- 
bash-completion



More information about the Bash-completion-commits mailing list