Debian Codegraph @

tests/match-lines

raw
1 #!/bin/sh
2 # Trigger a bug in the DFA matcher that would make
3 # grep -F -x -o PAT print an extra newline for each match.
4 # This would fail for grep-2.19 and grep-2.20.
5
6 # Copyright 2014-2025 Free Software Foundation, Inc.
7
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21 . "${srcdir=.}/init.sh"; path_prepend_ ../src
22
23 printf 'a\n' > in || framework_failure_
24
25 fail=0
26
27 for locale in C en_US.UTF-8; do
28 for options in -x '-E -x' '-F -x'; do
29 for o in '' -o; do
30 LC_ALL=$locale grep $o $options a in > out || fail=1
31 compare out in || fail=1
32 done
33 done
34 done
35
36 Exit $fail