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

Freddy Vulto fvulto at gmail.com
Wed Sep 16 20:22:18 UTC 2009


The following commit has been merged in the master branch:
commit c6a8b856de46f213217049082c3470fbceea467b
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Wed Sep 16 22:05:23 2009 +0200

    (testsuite) set +o history for bash < 3.2.41
    Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
    whenever a shopt setting is sourced or eval'ed.  Disabling 'history'
    makes it not show in tests "Environment should not be modified"
    for bash < 3.2.41.
    Added helper function `is_bash_version_minimal()' to
    test/lib/library.sh.

diff --git a/test/lib/library.sh b/test/lib/library.sh
index df683c6..a2973a0 100644
--- a/test/lib/library.sh
+++ b/test/lib/library.sh
@@ -24,3 +24,24 @@ echo_array() {
 	local IFS=$'\n'
 	eval echo \"\${$1[*]}\" | sort
 }
+
+
+# Check if current bash version meets specified minimum
+# @param $1  (integer) Major version number
+# @param $2  (integer) Minor version number
+# @param $3  (integer) Patch level
+# @return  0 if success, > 0 if not
+is_bash_version_minimal() {
+	[[      (
+			${BASH_VERSINFO[0]} -gt $1
+		) || (
+			${BASH_VERSINFO[0]} -eq $1 && 
+			${BASH_VERSINFO[1]} -gt $2
+		) || (
+			${BASH_VERSINFO[0]} -eq $1 && 
+			${BASH_VERSINFO[1]} -eq $2 && 
+			${BASH_VERSINFO[2]} -ge $3
+		)
+	]]
+} # is_bash_version_minimal()
+
diff --git a/test/lib/unit.exp b/test/lib/unit.exp
index 68bed0b..dd09f67 100644
--- a/test/lib/unit.exp
+++ b/test/lib/unit.exp
@@ -18,6 +18,12 @@ proc unit_start {} {
     assert_bash_exec {} "bash --rcfile config/bashrc"
     assert_bash_exec {BASH_COMPLETION_DIR=$(cd ..; pwd)/contrib}
     assert_bash_exec {BASH_COMPLETION=$(cd ..; pwd)/bash_completion}
+    # Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
+    # whenever a shopt setting is sourced or eval'ed.  Disabling 'history'
+    # makes it not show in tests "Environment should not be modified"
+    # for bash < 3.2.41.
+    # -- FVu, Tue Sep 15 22:52:00 CEST 2009
+    assert_bash_exec {is_bash_version_minimal 3 2 41 || set +o history}
     assert_bash_exec {source $BASH_COMPLETION}
 }; # unit_start()
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list