summaryrefslogtreecommitdiff
path: root/tests/prefix-of-multibyte
blob: b15fa9b320450fb57d85d43b8a58ef02452a8917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# This would mistakenly print a line prior to grep-2.6.2.
. "${srcdir=.}/init.sh"; path_prepend_ ../src

require_en_utf8_locale_
require_compiled_in_MB_support

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 /dev/null $out || fail=1
  done
done

Exit $fail