From: Pádraig Brady
Date: Sun, 10 Mar 2019 04:40:34 +0000 (-0800) Subject: tests: wc-nbsp: fix false failures on various systems X-Git-Tag: v8.31~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a971cd4ff713a7d9b845adaf3ae2fd1bf1a7e458;p=thirdparty%2Fcoreutils.git 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() --- diff --git a/tests/misc/wc-nbsp.sh b/tests/misc/wc-nbsp.sh index aca971cd87..65cdc8a313 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