diff options
author | Pádraig Brady <P@draigBrady.com> | 2019-03-09 20:40:34 -0800 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2019-03-09 20:59:21 -0800 |
commit | a971cd4ff713a7d9b845adaf3ae2fd1bf1a7e458 (patch) | |
tree | 8d75acc5f20a6bc4a59f7cdda7625db9e0a0e6c7 | |
parent | 66e2daa689fefec9ed201a04696b9f52d049d89a (diff) | |
download | coreutils-a971cd4ff713a7d9b845adaf3ae2fd1bf1a7e458.tar.gz |
tests: wc-nbsp: fix false failures on various systems
* tests/misc/wc-nbsp.sh: Add gating checks for all characters,
as there are disparate classifications on various systems:
SunOS 5.10 treats \u202F, \u2060 as !iswprint()
SunOS 5.10 treats \u00A0, \u2007 as iswspace()
AIX 7.2, Darwin 17.4.0, NetBSD 7.1 treat \u2060 as !iswprint()
-rwxr-xr-x | tests/misc/wc-nbsp.sh | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/misc/wc-nbsp.sh b/tests/misc/wc-nbsp.sh index aca971cd8..65cdc8a31 100755 --- a/tests/misc/wc-nbsp.sh +++ b/tests/misc/wc-nbsp.sh @@ -22,29 +22,31 @@ print_ver_ wc printf # Before coreutils 8.31 nbsp was treated as part of a word, # rather than a word delimiter -export LC_ALL=en_US.ISO-8859-1 -if test "$(locale charmap 2>/dev/null)" = ISO-8859-1; then +check_word_sep() { + char="$1" # Use -L to determine whether NBSP is printable. # FreeBSD 11 and OS X treat NBSP as non printable ? - if test "$(env printf '=\xA0=' | wc -L)" = 3; then - test $(env printf '=\xA0=' | wc -w) = 2 || fail=1 - test $(env printf '=\xA0=' | POSIXLY_CORRECT=1 wc -w) = 1 || fail=1 + if test "$(env printf "=$char=" | wc -L)" = 3; then + test $(env printf "=$char=" | wc -w) = 2 || fail=1 fi +} + +export LC_ALL=en_US.ISO-8859-1 +if test "$(locale charmap 2>/dev/null)" = ISO-8859-1; then + check_word_sep '\xA0' fi + export LC_ALL=en_US.UTF-8 if test "$(locale charmap 2>/dev/null)" = UTF-8; then - if test "$(env printf '=\u00A0=' | wc -L)" = 3; then - test $(env printf '=\u00A0=' | wc -w) = 2 || fail=1 - test $(env printf '=\u2007=' | wc -w) = 2 || fail=1 - test $(env printf '=\u202F=' | wc -w) = 2 || fail=1 - test $(env printf '=\u2060=' | wc -w) = 2 || fail=1 - fi + check_word_sep '\u00A0' + check_word_sep '\u2007' + check_word_sep '\u202F' + check_word_sep '\u2060' fi + export LC_ALL=ru_RU.KOI8-R if test "$(locale charmap 2>/dev/null)" = KOI8-R; then - if test "$(env printf '=\x9A=' | wc -L)" = 3; then - test $(env printf '=\x9A=' | wc -w) = 2 || fail=1 - fi + check_word_sep '\x9A' fi Exit $fail |