build: update gnulib to latest; and update bootstrap
[grep.git] / tests / encoding-error
blob6c3da2f99b66ede2d8ae4907ccfd3b8d14a93f1e
1 #! /bin/sh
2 # Test grep's behavior on encoding errors.
4 # Copyright 2015-2025 Free Software Foundation, Inc.
6 # Copying and distribution of this file, with or without modification,
7 # are permitted in any medium without royalty provided the copyright
8 # notice and this notice are preserved.
10 . "${srcdir=.}/init.sh"; path_prepend_ ../src
12 require_en_utf8_locale_
14 printf 'Alfred Jones\n' > a || framework_failure_
15 printf 'John Smith\n' >j || framework_failure_
16 printf 'Pedro P\351rez\n' >p || framework_failure_
17 cat a p j >in || framework_failure_
19 LC_ALL=en_US.UTF-8
20 export LC_ALL
22 fail=0
24 grep '^A' in >out || fail=1
25 compare a out || fail=1
27 grep '^P' in >out || fail=1
28 compare /dev/null out || fail=1
30 grep -I '^P' in >out 2>err || fail=1
31 compare /dev/null out || fail=1
32 compare /dev/null err || fail=1
34 grep '^J' in >out || fail=1
35 compare j out || fail=1
37 returns_ 1 grep '^X' in >out || fail=1
38 compare /dev/null out || fail=1
40 grep . in >out || fail=1
41 cat a j >exp || framework_failure_
42 compare exp out || fail=1
44 grep -I . in >out 2>err || fail=1
45 cat a j >exp || framework_failure_
46 compare exp out || fail=1
47 compare /dev/null err || fail=1
49 grep -a . in >out || fail=1
50 compare in out
52 Exit $fail