Debian Codegraph @

tests/word-delim-multibyte

raw
1 #!/bin/sh
2 # exercise \< and \> with multibyte data.
3 # Derived from https://savannah.gnu.org/bugs/?29537
4 . "${srcdir=.}/init.sh"; path_prepend_ ../src
5
6 require_en_utf8_locale_
7
8 e_acute=$(printf '\303\251')
9 echo "$e_acute" > in || framework_failure_
10 LC_ALL=en_US.UTF-8
11 export LC_ALL
12
13 fail=0
14
15 grep "\\<$e_acute" in > out 2>err || fail=1
16 compare out in || fail=1
17 compare /dev/null err || fail=1
18
19 grep "$e_acute\\>" in > out 2>err || fail=1
20 compare out in || fail=1
21 compare /dev/null err || fail=1
22
23 grep -w "$e_acute" in > out 2>err || fail=1
24 compare out in || fail=1
25 compare /dev/null err || fail=1
26
27 # Also ensure that this works in both the C locale and that multibyte one.
28 # In the C locale, it failed due to a dfa.c regression in grep-3.2.
29 echo 123-x > in || framework_failure_
30
31 for locale in C en_US.UTF-8; do
32 LC_ALL=$locale grep '.\bx' in > out 2>err || fail=1
33 compare out in || fail=1
34 compare /dev/null err || fail=1
35 done
36
37 # Bug#43255
38 printf 'a \303\255cone b\n' >in
39 for flag in '' -i; do
40 returns_ 1 env LC_ALL=en_US.UTF-8 grep -w $flag cone in >out 2>err || fail=1
41 compare /dev/null out || fail=1
42 compare /dev/null err || fail=1
43 done
44
45 Exit $fail