tests: skip C-locale sub-tests when "C" is multibyte

* testsuite/mb-bad-delim.sh: Don't run the sub-test that uses an
incomplete multibyte byte as a single-byte delimiter in C locale.
* testsuite/mb-y-translate.sh: Don't run the two sub-tests that
expect a y/// length-mismatch error in C locale.
Android's bionic libc uses UTF-8 even in the C locale, so these
sub-tests would always fail.
Reported by Bruno Haible in
https://lists.gnu.org/r/sed-devel/2026-04/msg00019.html
This commit is contained in:
Jim Meyering committed 2026-04-21 08:30:31 -07:00
1 parent 13604c8f68
commit f04e0da045
2 files changed
+19 -10

No files matched your search

+7 -4
View File
@@ -58,10 +58,13 @@ returns_ 1 env LC_ALL=en_US.UTF-8 sed -f prog2 </dev/null 2>err2 || fail=1
compare_ exp-err2 err2 || fail=1
# ... but accept octet \316 as delimiter in C locale
echo a > in2 || framework_failure_
echo b > exp2 || framework_failure_
LC_ALL=C sed -f prog2 <in2 >out2 || fail=1
compare_ exp2 out2 || fail=1
# Skip if C locale is multibyte (e.g., Android bionic defaults to UTF-8).
if test "$(LC_ALL=C get-mb-cur-max C)" = 1; then
echo a > in2 || framework_failure_
echo b > exp2 || framework_failure_
LC_ALL=C sed -f prog2 <in2 >out2 || fail=1
compare_ exp2 out2 || fail=1
fi
+12 -6
View File
@@ -49,11 +49,14 @@ LC_ALL=en_US.UTF-8 sed -f p1 <in1 >out1 || fail=1
compare_ exp1 out1 || fail=1
# in C locale, report error of mismatched length
cat <<\EOF > exp-err1 || framework_failure_
# Skip if C locale is multibyte (e.g., Android bionic defaults to UTF-8).
if test "$(LC_ALL=C get-mb-cur-max C)" = 1; then
cat <<\EOF > exp-err1 || framework_failure_
sed: file p1 line 1: 'y' command strings have different lengths
EOF
returns_ 1 env LC_ALL=C sed -f p1 </dev/null 2>err1 || fail=1
compare_ exp-err1 err1 || fail=1
returns_ 1 env LC_ALL=C sed -f p1 </dev/null 2>err1 || fail=1
compare_ exp-err1 err1 || fail=1
fi
#
@@ -67,11 +70,14 @@ LC_ALL=en_US.UTF-8 sed -f p2 <in2 >out2 || fail=1
compare_ exp2 out2 || fail=1
# in C locale, report error of mismatched length
cat <<\EOF > exp-err2 || framework_failure_
# Skip if C locale is multibyte (e.g., Android bionic defaults to UTF-8).
if test "$(LC_ALL=C get-mb-cur-max C)" = 1; then
cat <<\EOF > exp-err2 || framework_failure_
sed: file p2 line 1: 'y' command strings have different lengths
EOF
returns_ 1 env LC_ALL=C sed -f p2 </dev/null 2>err2 || fail=1
compare_ exp-err2 err2 || fail=1
returns_ 1 env LC_ALL=C sed -f p2 </dev/null 2>err2 || fail=1
compare_ exp-err2 err2 || fail=1
fi
#