]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: tests: refactor uses of bad_unicode()
authorPádraig Brady <P@draigBrady.com>
Wed, 4 Mar 2026 17:57:54 +0000 (17:57 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 4 Mar 2026 17:57:54 +0000 (17:57 +0000)
* init.cfg: Use 0xFF rather than 0xC3 everywhere.
* tests/fold/fold-characters.sh: Reuse bad_unicode().
* tests/tac/tac-locale.sh: Likewise.

init.cfg
tests/fold/fold-characters.sh
tests/tac/tac-locale.sh

index ae02adcfd7183a90dc2a7829394c7226a78f80ce..0896d8ddac7518990c289e8e2ff983f28e06bee5 100644 (file)
--- a/init.cfg
+++ b/init.cfg
@@ -837,7 +837,7 @@ bad_unicode ()
   require_built_ printf
 
   # invalid UTF8|unpaired surrogate|C1 control|noncharacter
-  env printf '\xC3|\xED\xBA\xAD|\u0089|\xED\xA6\xBF\xED\xBF\xBF\n'
+  env printf '\xFF|\xED\xBA\xAD|\u0089|\xED\xA6\xBF\xED\xBF\xBF\n'
 }
 
 # AIX has a 'strace' program unrelated to the one we care about.  Avoid
index 5af9856f65851f57760b56a5477002edd806031a..6edaa9c0596a9eacf5e685b5f30dcf5bb0062063 100755 (executable)
@@ -83,12 +83,7 @@ env printf '\naaaa\n' >> exp3 || framework_failure_
 fold --characters input3 | tail -n 4 > out3 || fail=1
 compare exp3 out3 || fail=1
 
-# Sequence derived from <https://datatracker.ietf.org/doc/rfc9839>.
-bad_unicode_with_nul ()
-{
-  # invalid UTF8|unpaired surrogate|NUL|C1 control|noncharacter
-  env printf '\xFF|\xED\xBA\xAD|\u0000|\u0089|\xED\xA6\xBF\xED\xBF\xBF\n'
-}
+bad_unicode_with_nul () { env printf '%s|\u0000\n' "$(bad_unicode)"; }
 bad_unicode_with_nul > exp4 || framework_failure_
 bad_unicode_with_nul | fold > out4 || fail=1
 compare exp4 out4 || fail=1
index 9a96a66b8581b3efee81bd988e9afe64041f75b9..70833db11ca4be7ccdf8d4dac847c9dcee76559d 100755 (executable)
@@ -38,8 +38,7 @@ export LC_ALL=$LOCALE_FR_UTF8
 if test "$(locale charmap 2>/dev/null)" = UTF-8; then
   check_separator '\u0434'  # д
   check_separator '\u0434\u0436'  # дж
-  # invalid UTF8|unpaired surrogate|C1 control|noncharacter
-  check_separator '\xC3|\xED\xBA\xAD|\u0089|\xED\xA6\xBF\xED\xBF\xBF'
+  check_separator "$(bad_unicode)"
 fi
 
 Exit $fail