1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tests/locale.sh: fix UTF-8 test to use builtin command

This test used an unportable invocation of an external 'join'
command. The options used were Solaris-specific. Not all OSs
support UTF-8 in their external utilities so using an external
utility is not appropriate.

src/cmd/ksh93/tests/locale.sh:
- Rewrite the 'join test script' to use ksh builtin 'cut' instead.
  This should suffice to check whether the locale is correctly set,
  which is the point of this test.

(cherry picked from commit fb16f33ff1e9d33d5fccc5cf9633d508eb6eecc7)
This commit is contained in:
Martijn Dekker 2020-05-14 18:25:20 +01:00
parent 11226f9edd
commit 49c7a52edd

View file

@ -189,10 +189,11 @@ printf 'f1\357\274\240f2\n' > input1
printf 't2\357\274\240f1\n' > input2
printf '\357\274\240\n' > delim
print "export LC_ALL=$locale
join -j1 1 -j2 2 -o 1.1 -t \$(cat delim) input1 input2 > out" > script
builtin cut || exit
cut -f 1 -d \$(cat delim) input1 input2 > out" > script
$SHELL -c 'unset LANG ${!LC_*}; $SHELL ./script' ||
err_exit "join test script failed -- exit code $?"
exp="f1"
err_exit "'cut' builtin failed -- exit code $?"
exp=$'f1\nt2'
got="$(<out)"
[[ $got == "$exp" ]] || err_exit "LC_ALL test script failed -- expected '$exp', got '$got'"