mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
tests/locale.sh: fix test that depended on 'od' whitespace output
Different implementations of the 'od' command may legitimately vary the whitespace they output between fields. One of the regression tests checked 'od' output without tolerating whitespace varieties, which is not portable. For example, the BSD 'od' implementation outputs more whitespace than the variant used to write the test. src/cmd/ksh93/tests/locale.sh: - In test "incorrect string from printf %q", use 'awk' to eliminate whitespace from 'od' output before checking results. (cherry picked from commit 7aa830bd3a2284f7228ee7189f5671749c3f2682)
This commit is contained in:
parent
49c7a52edd
commit
b87a7cabc5
1 changed files with 5 additions and 2 deletions
|
@ -330,8 +330,11 @@ then LC_ALL=en_US.UTF-8
|
|||
x=$(printf "hello\u[20ac]\xee world")
|
||||
[[ $(print -r -- "$x") == $'hello\u[20ac]\xee world' ]] || err_exit '%q with unicode and non-unicode not working'
|
||||
if [[ $(whence od) ]]
|
||||
then got='68 65 6c 6c 6f e2 82 ac ee 20 77 6f 72 6c 64 0a'
|
||||
[[ $(print -r -- "$x" | od -An -tx1) == "$got" ]] || err_exit "incorrect string from printf %q"
|
||||
then got='68656c6c6fe282acee20776f726c640a'
|
||||
[[ $(print -r -- "$x" | od -An -tx1 \
|
||||
| awk 'BEGIN { ORS=""; } { for (i=1; i<=NF; i++) print $i; }') \
|
||||
== "$got" ]] \
|
||||
|| err_exit "incorrect string from printf %q"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue