summaryrefslogtreecommitdiff
path: root/tests/prefix-of-multibyte
diff options
context:
space:
mode:
authorNorihiro Tanaka <noritnk@kcn.ne.jp>2010-03-28 18:42:42 +0200
committerJim Meyering <meyering@redhat.com>2010-03-28 20:59:44 +0200
commit2a7421f3f76e7781db7e712b56076dc576dc94a1 (patch)
tree13760e52d0947632d758a3528fdf342a50e9a2bf /tests/prefix-of-multibyte
parent04370ef1ee2bcdeda9f8c85f27c6116d6fb341a6 (diff)
downloadgrep-2a7421f3f76e7781db7e712b56076dc576dc94a1.tar.gz
tests: exercise fix for improper match of incomplete MB char prefix
* tests/prefix-of-multibyte: New file. * tests/Makefile.am (TESTS): Add it.
Diffstat (limited to 'tests/prefix-of-multibyte')
-rw-r--r--tests/prefix-of-multibyte19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/prefix-of-multibyte b/tests/prefix-of-multibyte
new file mode 100644
index 00000000..f9e42bf1
--- /dev/null
+++ b/tests/prefix-of-multibyte
@@ -0,0 +1,19 @@
+#!/bin/sh
+# This would mistakenly print a line prior to grep-2.6.2.
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+encode() { echo "$1" | tr ABC '\357\274\241'; }
+
+fail=0
+
+for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
+ for opt in '' '-F'; do
+ out=out-$opt-$LOC
+ encode ABC | LC_ALL=$LOC grep $opt "$(encode A)" > $out 2>&1
+ test $? = 1 || fail=1
+ compare $out /dev/null || fail=1
+ done
+done
+
+Exit $fail