mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-30 22:51:18 +02:00
test suite fixes for some locales; fix to make bind -x bindings work with negative arguments; several portability fixes from pkgsrc; fixes for funsubs with return builtin state and local OPTIND
This commit is contained in:
+4
-4
@@ -14,10 +14,10 @@
|
||||
. ./test-glue-functions
|
||||
|
||||
# this locale causes problems all over the place
|
||||
if locale -a | grep -i '^zh_HK\.big5hkscs' >/dev/null ; then
|
||||
if locale -a | grep -i '^zh_TW\.big5' >/dev/null ; then
|
||||
:
|
||||
else
|
||||
echo "glob2.sub: warning: you do not have the zh_HK.big5hkscs locale installed;" >&2
|
||||
echo "glob2.sub: warning: you do not have the zh_TW.big5 locale installed;" >&2
|
||||
echo "glob2.sub: warning: that will cause some of these tests to fail." >&2
|
||||
fi
|
||||
|
||||
@@ -41,7 +41,7 @@ esac
|
||||
[[ $var = $var ]] && echo ok 4
|
||||
[[ $var = $'ab\134' ]] && echo ok 5
|
||||
|
||||
LC_ALL=zh_HK.big5hkscs
|
||||
LC_ALL=zh_TW.big5
|
||||
|
||||
read a b c <<< $'\u3b1 b c\n'
|
||||
echo $b
|
||||
@@ -62,4 +62,4 @@ printf "%s" "a${alpha}b" | LC_ALL=C od -b | _intl_normalize_spaces
|
||||
a=$'\u3b1'
|
||||
[[ $a = $a ]] && echo ok 6
|
||||
|
||||
LC_ALL=zh_HK.big5hkscs ${THIS_SH} -c $'[[ \u3b1 = \u3b1 ]]' && echo ok 7
|
||||
LC_ALL=zh_TW.big5 ${THIS_SH} -c $'[[ \u3b1 = \u3b1 ]]' && echo ok 7
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ aéb
|
||||
bytematch
|
||||
0000000 254 012
|
||||
0000002
|
||||
Passed all 1378 Unicode tests
|
||||
Passed all 1774 Unicode tests
|
||||
0000000 303 277 012
|
||||
0000003
|
||||
0000000 303 277 012
|
||||
|
||||
+18
-30
@@ -11,45 +11,27 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Originally donated by John Kearney <dethrophes@web.de> Tue, 21 Feb 2012
|
||||
# Updates from Grisha Levit <grishalevit@gmail.com> 22 Nov 2023
|
||||
#
|
||||
unset LC_ALL
|
||||
|
||||
ErrorCnt=0
|
||||
TestCnt=0
|
||||
|
||||
function check_valid_var_name {
|
||||
case "${1:?Missing Variable Name}" in
|
||||
[!a-zA-Z_]* | *[!a-zA-Z_0-9]* ) return 3;;
|
||||
esac
|
||||
}
|
||||
# get_array_element VariableName ArrayName ArrayElement
|
||||
function get_array_element {
|
||||
check_valid_var_name "${1:?Missing Variable Name}" || return $?
|
||||
check_valid_var_name "${2:?Missing Array Name}" || return $?
|
||||
eval "${1}"'="${'"${2}"'["${3:?Missing Array Index}"]}"'
|
||||
}
|
||||
# unset_array_element VarName ArrayName
|
||||
function get_array_element_cnt {
|
||||
check_valid_var_name "${1:?Missing Variable Name}" || return $?
|
||||
check_valid_var_name "${2:?Missing Array Name}" || return $?
|
||||
eval "${1}"'="${#'"${2}"'[@]}"'
|
||||
}
|
||||
|
||||
|
||||
function TestCodePage {
|
||||
local TargetCharset="${1:?Missing Test charset}"
|
||||
local EChar RChar TCnt
|
||||
get_array_element_cnt TCnt "${2:?Missing Array Name}"
|
||||
for (( x=1 ; x<${TCnt} ; x++ )); do
|
||||
get_array_element EChar "${2}" ${x}
|
||||
if [ -n "${EChar}" ]; then
|
||||
local EChar RChar Uval x
|
||||
local -n Array=${2:?Missing Array Name}
|
||||
for x in "${!Array[@]}"; do
|
||||
let TestCnt+=1
|
||||
EChar=${Array[$x]}
|
||||
printf -v UVal '\\U%08x' "${x}"
|
||||
LC_CTYPE=${TargetCharset} printf -v RChar "${UVal}" 2>/dev/null
|
||||
if [ "${EChar}" != "${RChar}" ]; then
|
||||
let ErrorCnt+=1
|
||||
printf "${TargetCharset}: Error Encoding U+%08X to ${TL} [ \"%q\" != \"%q\" ]\n" "${x}" "${EChar}" "${RChar}"
|
||||
printf "%s: Error Encoding U+%08X [ \"%q\" != \"%q\" ]\n" "${TargetCharset}" "${x}" "${EChar}" "${RChar}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -118,8 +100,14 @@ else
|
||||
fi
|
||||
|
||||
zh_TW_BIG5=(
|
||||
[0x00f6]=$'\366' [0x00f7]=$'\367' [0x00f8]=$'\370' [0x00f9]=$'\371' [0x00fa]=$'\372'
|
||||
[0x00fb]=$'\373' [0x00fc]=$'\374' [0x00fd]=$'\375' [0x00fe]=$'\376'
|
||||
# these are the original incorrect tests
|
||||
# [0x00f6]=$'\366' [0x00f7]=$'\367' [0x00f8]=$'\370' [0x00f9]=$'\371' [0x00fa]=$'\372'
|
||||
# [0x00fb]='\373' [0x00fc]=$'\374' [0x00fd]=$'\375' [0x00fe]=$'\376'
|
||||
# some valid encodings
|
||||
[0x03A8]=$'\243Z' [0x03A9]=$'\243[' [0x03B1]=$'\243\\' [0x03B2]=$'\243]'
|
||||
[0x03B3]=$'\243^' [0x03B4]=$'\243_' [0x03B5]=$'\243`' [0x03B6]=$'\243a'
|
||||
# and some invalid ones that output \u0XX
|
||||
[0x00fb]='\u00FB' [0x00fc]='\u00FC' [0x00fd]='\u00FD' [0x00fe]='\u00FE'
|
||||
)
|
||||
TestCodePage zh_TW.BIG5 zh_TW_BIG5
|
||||
|
||||
@@ -324,10 +312,10 @@ else
|
||||
echo "unicode1.sub: that will cause some of these tests to be skipped." >&2
|
||||
fi
|
||||
|
||||
#for ((x=1;x<1000;x++)); do printf ' [0x%04x]=%-11q' "$x" "$(printf "$(printf '\\U%08x' $x)")" ; [ $(($x%5)) = 0 ] && echo; done
|
||||
#for ((x=1;x<1000;x++)); do printf -v u '\\U%08x' "$x"; printf ' [0x%04x]=%-11q' "$x" "${u@E}"; [ $(($x%5)) = 0 ] && echo; done
|
||||
C_UTF_8=(
|
||||
[0x0001]=$'\001' [0x0002]=$'\002' [0x0003]=$'\003' [0x0004]=$'\004' [0x0005]=$'\005'
|
||||
[0x0006]=$'\006' [0x0007]=$'\a' [0x0008]=$'\b' [0x0009]=$'\t' [0x000a]=''
|
||||
[0x0006]=$'\006' [0x0007]=$'\a' [0x0008]=$'\b' [0x0009]=$'\t' [0x000a]=$'\n'
|
||||
[0x000b]=$'\v' [0x000c]=$'\f' [0x000d]=$'\r' [0x000e]=$'\016' [0x000f]=$'\017'
|
||||
[0x0010]=$'\020' [0x0011]=$'\021' [0x0012]=$'\022' [0x0013]=$'\023' [0x0014]=$'\024'
|
||||
[0x0015]=$'\025' [0x0016]=$'\026' [0x0017]=$'\027' [0x0018]=$'\030' [0x0019]=$'\031'
|
||||
|
||||
Reference in New Issue
Block a user