summaryrefslogtreecommitdiff
path: root/tests/turkish-eyes
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-09-23 18:57:57 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-09-23 19:56:24 -0700
commit016e590a8198009bce0e1078f6d4c7e037e2df3c (patch)
tree65f7540d987aa52c0a74e4462c613f1e136d8291 /tests/turkish-eyes
parentc6b0b7df3a4824b9bd3ee2bb96f96ab6b1a7cb76 (diff)
downloadgrep-016e590a8198009bce0e1078f6d4c7e037e2df3c.tar.gz
grep: fix more Turkish-eyes bugs
Fix more bugs recently uncovered by Norihiro Tanaka (Bug#43577). * NEWS: Mention new bug report. * src/grep.c (ok_fold): New static var. (setup_ok_fold): New function. (fgrep_icase_charlen): Reject single-byte characters if they match some multibyte characters when ignoring case. This part of the patch is partly derived from <https://bugs.gnu.org/43577#14>, which means it is: Co-authored-by: Norihiro Tanaka <noritnk@kcn.ne.jp> (main): Call setup_ok_fold if ok_fold might be needed. * src/searchutils.c (kwsinit): With the grep.c changes, this code can now revert to classic 7th Edition Unix style; aborting would be wrong. * tests/turkish-eyes: Add tests for these bugs.
Diffstat (limited to 'tests/turkish-eyes')
-rwxr-xr-xtests/turkish-eyes18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/turkish-eyes b/tests/turkish-eyes
index ba1ea33b..879b59d4 100755
--- a/tests/turkish-eyes
+++ b/tests/turkish-eyes
@@ -36,11 +36,23 @@ i=$(printf '\304\261') # lowercase dotless i
data="I:$I $i:i"
search_str="$i:i I:$I"
-printf "$data\n" > in || framework_failure_
+printf "$data\\n" > in || framework_failure_
for opt in -E -F -G; do
- LC_ALL=$L grep $opt -i "$search_str" in > out || fail=1
- compare out in || fail=1
+ for pat in i I "$i" "$I" " " : "$search_str"; do
+ LC_ALL=$L grep $opt -i "$pat" in > out || fail=1
+ compare in out || fail=1
+
+ case $pat in
+ i|"$I") printf "$I\\ni\\n";;
+ I|"$i") printf "I\\n$i\\n";;
+ :) printf ":\\n:\\n";;
+ ' ') printf " \\n";;
+ *) cat in;;
+ esac >exp || framework_failure_
+ LC_ALL=$L grep -o $opt -i "$pat" in > out || fail=1
+ compare exp out || fail=1
+ done
done
Exit $fail