Debian Codegraph @

tests/binary-file-matches

raw
1 #! /bin/sh
2 # Test for the "binary file ... matches" diagnostic.
3 #
4 # Copyright (C) 2020-2025 Free Software Foundation, Inc.
5 #
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.
9
10 . "${srcdir=.}/init.sh"; path_prepend_ ../src
11
12 fail=0
13
14 echo "grep: (standard input): binary file matches" > exp \
15 || framework_failure_
16
17 for option in '' -s; do
18 printf 'a\0' | grep $option a > out 2> err || fail=1
19 compare /dev/null out || fail=1
20 compare exp err || fail=1
21 done
22
23 Exit $fail