diffutils/tests/ignore-tab-expansion
Paul Eggert a542ab269a diff: support multi-byte comparison
* bootstrap.conf (gnulib_modules): Add c32isspace, c32tolower.
* lib/Makefile.am (noinst_HEADERS): Add mbcel.h.
(libdiffutils_a_SOURCES): Add mbcel.c
* lib/mbcel.c, lib/mbcel.h: New files.
* src/io.c: Include mbcel.h, uchar.h.
(hash): 2nd arg is now hash_value, not merely unsigned char,
since the caller might pass a char32_t now.
(find_and_hash_each_line): Support multi-byte input.
* src/util.c: Include mbcel.h, uchar.h.
(lines_differ): New args S1LEN, S2LEN, needed for mbcel_scan.
Caller changed.  Support multi-byte input.
* tests/ignore-case: New file.
* tests/Makefile.am (TESTS): Add it.
* tests/ignore-tab-expansion: Add UTF-8 test.
* tests/init.cfg (require_utf8_locale_): New function.
* tests/side-by-side: Use it.  Add a column-counting test.
2023-07-09 01:19:45 -07:00

29 lines
520 B
Bash
Executable File

#!/bin/sh
# Test ignoring tab expansion.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
fail=0
for p in '\b' '\r' '\t ' '\n'; do
printf "$p"'\b\tx\n' >a || framework_failure_
printf "$p"'\b x\n' >b || framework_failure
diff -E a b >out || fail=1
compare /dev/null out || fail=1
done
require_utf8_locale_
tr '_@' ' \t' >a <<\EOF
@字字字xx@x_@字_@xxx_x@@x
EOF
tr '_@' ' \t' >b <<\EOF
_@字字字xx________x_@字_@xxx_x@@x
EOF
diff -E a b >out || fail=1
compare /dev/null out || fail=1
Exit $fail