| 1 |
#!/bin/sh |
| 2 |
# Check that GREP_COLOR elicits a warning. |
| 3 |
|
| 4 |
# Copyright 2022-2025 Free Software Foundation, Inc. |
| 5 |
|
| 6 |
# This program is free software: you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation, either version 3 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
|
| 11 |
# This program is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
|
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src |
| 20 |
|
| 21 |
fail=0 |
| 22 |
unset GREP_COLORS |
| 23 |
unset GREP_COLOR |
| 24 |
LC_ALL=C |
| 25 |
export LC_ALL |
| 26 |
|
| 27 |
printf 'x\n\n' >in || framework_failure_ |
| 28 |
printf '%s\n' \ |
| 29 |
"grep: warning: GREP_COLOR='36' is deprecated; use GREP_COLORS='mt=36'" \ |
| 30 |
>exp.err || framework_failure_ |
| 31 |
|
| 32 |
GREP_COLORS='mt=36:ln=35' grep --color=always . in >exp 2>err || fail=1 |
| 33 |
compare /dev/null err || fail=1 |
| 34 |
GREP_COLOR='36' GREP_COLORS='ln=35' grep --color=always . in >out 2>err \ |
| 35 |
|| fail=1 |
| 36 |
compare exp out || fail=1 |
| 37 |
compare exp.err err || fail=1 |
| 38 |
|
| 39 |
GREP_COLORS='mt=36' grep --color=always . in >exp 2>err || fail=1 |
| 40 |
compare /dev/null err || fail=1 |
| 41 |
GREP_COLOR='36' grep --color=always . in >out 2>err || fail=1 |
| 42 |
compare exp out || fail=1 |
| 43 |
compare exp.err err || fail=1 |
| 44 |
|
| 45 |
GREP_COLORS='ln=35' grep --color=always . in >out 2>err || fail=1 |
| 46 |
compare /dev/null err || fail=1 |
| 47 |
|
| 48 |
Exit $fail |