Use linear arrays in ispell test to work with old bash

* test/lisp/textmodes/ispell-resources/fake-aspell-new.bash:
Avoid using associative arrays since they are not available
in old bash versions that come with some systems (bug#79177).
This commit is contained in:
Mattias Engdegård
2025-09-13 16:32:32 +02:00
parent 01e7d537b0
commit cb17a8bbf3

View File

@@ -22,10 +22,18 @@ show_vv()
printf '%s\n' "@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.0)"
}
in_dict()
{
local x=$1
for y in ${sessiondict[@]}; do
if [ $y = $x ]; then return 0; fi
done
return 1
}
imitate_pipe()
{
local a
declare -A sessiondict
show_vv
while read a ; do
#printf 'pipe="%s"\n' "$a" >> /tmp/lwf_mock-aspell.log
@@ -34,13 +42,13 @@ imitate_pipe()
elif [[ "$a" == '+' || "$a" == '~nroff' || "$a" == '~tex' || "$a" == '!' || "$a" == '-' || "$a" == '%' ]] ; then
printf ''
elif [[ "${a:0:1}" == '@' ]] ; then
sessiondict["${a:1}"]="true"
sessiondict+=("${a:1}")
printf ''
else
for b in $a ; do
if [[ "$b" == '^' ]] ; then
printf ''
elif [[ ${sessiondict[$b]} == 'true' || ${sessiondict[${b#^}]} == 'true' ]] ; then
elif in_dict "$b" || in_dict "${b#^}" ; then
printf '*\n'
elif [[ "$b" == '^tarampampamtararam' || "$b" == 'tarampampamtararam' ]] ; then
printf '# tarampampamtararam 0\n' # wrong word