Blame gnulib-tests/test-exclude8.sh

Packit 33f14e
#! /bin/sh
Packit 33f14e
# Test suite for exclude.
Packit 33f14e
# Copyright (C) 2010-2017 Free Software Foundation, Inc.
Packit 33f14e
# This file is part of the GNUlib Library.
Packit 33f14e
#
Packit 33f14e
# This program is free software: you can redistribute it and/or modify
Packit 33f14e
# it under the terms of the GNU General Public License as published by
Packit 33f14e
# the Free Software Foundation; either version 3 of the License, or
Packit 33f14e
# (at your option) any later version.
Packit 33f14e
#
Packit 33f14e
# This program is distributed in the hope that it will be useful,
Packit 33f14e
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 33f14e
# GNU General Public License for more details.
Packit 33f14e
#
Packit 33f14e
# You should have received a copy of the GNU General Public License
Packit 33f14e
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 33f14e
Packit 33f14e
. "${srcdir=.}/init.sh"; path_prepend_ .
Packit 33f14e
fail=0
Packit 33f14e
Packit 33f14e
# Test escaped metacharacters.
Packit 33f14e
Packit 33f14e
cat > in <<'EOT'
Packit 33f14e
f\*e
Packit 33f14e
b[a\*]r
Packit 33f14e
EOT
Packit 33f14e
Packit 33f14e
cat > expected <<'EOT'
Packit 33f14e
f*e: 1
Packit 33f14e
file: 0
Packit 33f14e
bar: 1
Packit 33f14e
EOT
Packit 33f14e
Packit 33f14e
test-exclude -wildcards in -- 'f*e' 'file' 'bar' > out || exit $?
Packit 33f14e
Packit 33f14e
# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
Packit 33f14e
# does not understand '\r'.
Packit 33f14e
case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
Packit 33f14e
Packit 33f14e
# normalize output
Packit 33f14e
LC_ALL=C tr -d "$cr" < out > k && mv k out
Packit 33f14e
Packit 33f14e
compare expected out || fail=1
Packit 33f14e
Packit 33f14e
Exit $fail