Use Bash arrays instead of POSIX splitting when possible

This commit is contained in:
Rangi
2026-07-06 04:43:08 +02:00
committed by Eldred Habert
parent 3eb8c7e8f2
commit 09da4e001a
3 changed files with 21 additions and 21 deletions
+6 -6
View File
@@ -93,9 +93,9 @@ for i in *.asm; do
startTest
"$RGBASM" -o "$otemp" "${test}.asm"
RGBLINKFLAGS=""
RGBLINKFLAGS=()
if [ -f "${test}.flags" ]; then
RGBLINKFLAGS="$RGBLINKFLAGS @${test}.flags"
RGBLINKFLAGS+=("@${test}.flags")
fi
# Some tests have variants depending on flags
@@ -103,14 +103,14 @@ for i in *.asm; do
for flag in '-d' '-t' '-w'; do
if [ -f "${test}-no${flag}.out" ]; then
continueTest "-no${flag}"
rgblinkQuiet $RGBLINKFLAGS -o "$gbtemp" "$otemp" 2>"$outtemp"
rgblinkQuiet "${RGBLINKFLAGS[@]}" -o "$gbtemp" "$otemp" 2>"$outtemp"
tryDiff "${test}-no${flag}.out" "$outtemp"
evaluateTest
ran_flag=true
fi
if [ -f "${test}${flag}.out" ]; then
continueTest "$flag"
rgblinkQuiet $RGBLINKFLAGS ${flag} -o "$gbtemp" "$otemp" 2>"$outtemp"
rgblinkQuiet "${RGBLINKFLAGS[@]}" ${flag} -o "$gbtemp" "$otemp" 2>"$outtemp"
tryDiff "${test}${flag}.out" "$outtemp"
evaluateTest
ran_flag=true
@@ -125,7 +125,7 @@ for i in *.asm; do
[[ -e "$script" ]] || break # If the glob doesn't match, it just... doesn't expand!
continueTest "${script#${test}}"
rgblinkQuiet $RGBLINKFLAGS -l "$script" -o "$gbtemp" "$otemp" 2>"$outtemp"
rgblinkQuiet "${RGBLINKFLAGS[@]}" -l "$script" -o "$gbtemp" "$otemp" 2>"$outtemp"
tryDiff "${script%.link}.out" "$outtemp"
evaluateTest
ran_flag=true
@@ -136,7 +136,7 @@ for i in *.asm; do
# The rest of the tests just links a file, and maybe checks the binary
continueTest
rgblinkQuiet $RGBLINKFLAGS -o "$gbtemp" "$otemp" 2>"$outtemp"
rgblinkQuiet "${RGBLINKFLAGS[@]}" -o "$gbtemp" "$otemp" 2>"$outtemp"
tryDiff "${test}.out" "$outtemp"
bin=${test}.out.bin
if [ -f "$bin" ]; then