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

Ville Skyttä ville.skytta at iki.fi
Sat Jan 30 13:02:12 UTC 2010


The following commit has been merged in the master branch:
commit 8f4111d5a43500775bbb22edcf0d6cc02280566b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Jan 30 14:56:39 2010 +0200

    (testsuite) Don't fail long option tests if command has no long options.
    
    Many basic commands do not have long options on non-GNU systems, mark such
    tests as unsupported (if the command doesn't respond to --help) instead of
    failing.
    
    Implemented with the new $failcmd parameter to assert_exec().

diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp
index 0f523cb..f03f539 100644
--- a/test/lib/completions/env.exp
+++ b/test/lib/completions/env.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "env --"
+if {[assert_exec {env --help} "" "" "unsupported"]} {
+    assert_complete_any "env --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp
index de1b7f6..d5cd6b1 100644
--- a/test/lib/completions/expand.exp
+++ b/test/lib/completions/expand.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "expand --"
+if {[assert_exec {expand --help} "" "" "unsupported"]} {
+    assert_complete_any "expand --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/fold.exp b/test/lib/completions/fold.exp
index 673fe21..a5230b0 100644
--- a/test/lib/completions/fold.exp
+++ b/test/lib/completions/fold.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "fold --"
+if {[assert_exec {fold --help} "" "" "unsupported"]} {
+    assert_complete_any "fold --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/gprof.exp b/test/lib/completions/gprof.exp
index b436b9d..592786a 100644
--- a/test/lib/completions/gprof.exp
+++ b/test/lib/completions/gprof.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "gprof --"
+if {[assert_exec {gprof --help} "" "" "unsupported"]} {
+    assert_complete_any "gprof --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/head.exp b/test/lib/completions/head.exp
index 9782f5e..0d4f6a2 100644
--- a/test/lib/completions/head.exp
+++ b/test/lib/completions/head.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "head --"
+if {[assert_exec {head --help} "" "" "unsupported"]} {
+    assert_complete_any "head --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp
index 82e898c..db2d41d 100644
--- a/test/lib/completions/ls.exp
+++ b/test/lib/completions/ls.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "ls --"
+if {[assert_exec {ls --help} "" "" "unsupported"]} {
+    assert_complete_any "ls --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/m4.exp b/test/lib/completions/m4.exp
index 6ed4344..2cc884b 100644
--- a/test/lib/completions/m4.exp
+++ b/test/lib/completions/m4.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "m4 --"
+if {[assert_exec {m4 --help} "" "" "unsupported"]} {
+    assert_complete_any "m4 --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/sed.exp b/test/lib/completions/sed.exp
index 0584107..8764cfb 100644
--- a/test/lib/completions/sed.exp
+++ b/test/lib/completions/sed.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "sed --"
+if {[assert_exec {sed --help} "" "" "unsupported"]} {
+    assert_complete_any "sed --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/split.exp b/test/lib/completions/split.exp
index 249ff9b..b74da36 100644
--- a/test/lib/completions/split.exp
+++ b/test/lib/completions/split.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "split --"
+if {[assert_exec {split --help} "" "" "unsupported"]} {
+    assert_complete_any "split --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/tail.exp b/test/lib/completions/tail.exp
index fb8d89e..c8a82d9 100644
--- a/test/lib/completions/tail.exp
+++ b/test/lib/completions/tail.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "tail --"
+if {[assert_exec {tail --help} "" "" "unsupported"]} {
+    assert_complete_any "tail --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/touch.exp b/test/lib/completions/touch.exp
index d8b07ce..f0960ef 100644
--- a/test/lib/completions/touch.exp
+++ b/test/lib/completions/touch.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "touch --"
+if {[assert_exec {touch --help} "" "" "unsupported"]} {
+    assert_complete_any "touch --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/tr.exp b/test/lib/completions/tr.exp
index 87e93fa..68b11a3 100644
--- a/test/lib/completions/tr.exp
+++ b/test/lib/completions/tr.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "tr --"
+if {[assert_exec {tr --help} "" "" "unsupported"]} {
+    assert_complete_any "tr --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/uname.exp b/test/lib/completions/uname.exp
index 8de0eed..2179daf 100644
--- a/test/lib/completions/uname.exp
+++ b/test/lib/completions/uname.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "uname --"
+if {[assert_exec {uname --help} "" "" "unsupported"]} {
+    assert_complete_any "uname --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/unexpand.exp b/test/lib/completions/unexpand.exp
index ecb726f..3182256 100644
--- a/test/lib/completions/unexpand.exp
+++ b/test/lib/completions/unexpand.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "unexpand --"
+if {[assert_exec {unexpand --help} "" "" "unsupported"]} {
+    assert_complete_any "unexpand --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/uniq.exp b/test/lib/completions/uniq.exp
index 6b91559..20dbcfa 100644
--- a/test/lib/completions/uniq.exp
+++ b/test/lib/completions/uniq.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "uniq --"
+if {[assert_exec {uniq --help} "" "" "unsupported"]} {
+    assert_complete_any "uniq --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/units.exp b/test/lib/completions/units.exp
index b4c52b0..a40b5f3 100644
--- a/test/lib/completions/units.exp
+++ b/test/lib/completions/units.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "units --"
+if {[assert_exec {units --help} "" "" "unsupported"]} {
+    assert_complete_any "units --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/wc.exp b/test/lib/completions/wc.exp
index d4e04ca..8ad2bf8 100644
--- a/test/lib/completions/wc.exp
+++ b/test/lib/completions/wc.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "wc --"
+if {[assert_exec {wc --help} "" "" "unsupported"]} {
+    assert_complete_any "wc --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/completions/who.exp b/test/lib/completions/who.exp
index be3ed28..73928ef 100644
--- a/test/lib/completions/who.exp
+++ b/test/lib/completions/who.exp
@@ -11,7 +11,9 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "who --"
+if {[assert_exec {who --help} "" "" "unsupported"]} {
+    assert_complete_any "who --"
+}; # if
 
 
 sync_after_int
diff --git a/test/lib/library.exp b/test/lib/library.exp
index fab33bf..60062cc 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -397,15 +397,17 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} {
 
 # Make sure the specified command executed from within Tcl/Expect.
 # Fail the test with status UNSUPPORTED if Tcl fails with error "POSIX/ENOENT
-# (No such file or directory)", or UNRESOLVED if other error occurs.  
+# (No such file or directory)", or with the given Tcl failure status command
+# (default "unresolved") if other error occurs.
 # NOTE: Further tests are assumed if executing the command is successful.  The
 #       test isn't immediately declared to have PASSED if the command is
 #       executed successful.
 # @param string $command
 # @param string $stdout  (optional) Reference to variable to hold stdout.
 # @param string $test (optional)  Test title
+# @param string $failcmd (optional, default "unresolved")  Failure command
 # @see assert_bash_exec()
-proc assert_exec {cmd {stdout ''} {test ''}} {
+proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} {
     if {$test == ""} {set test "$cmd should execute successfully"}
     upvar $stdout results
     set status [catch {eval exec $cmd} results]
@@ -419,7 +421,7 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
                 # Indicate test is unsupported
             unsupported "$test"
         } else {
-            unresolved "$test"
+            $failcmd "$test"
         }; # if
     }; # if
     return $result

-- 
bash-completion



More information about the Bash-completion-commits mailing list