Blame gnulib-tests/test-exclude2.sh

Packit 33f14e
#! /bin/sh
Packit 33f14e
# Test suite for exclude.
Packit 33f14e
# Copyright (C) 2009-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
cat > in <
Packit 33f14e
foo*
Packit 33f14e
bar
Packit 33f14e
Baz
Packit 33f14e
EOT
Packit 33f14e
Packit 33f14e
# Test case-insensitive literal matches
Packit 33f14e
Packit 33f14e
cat > expected <
Packit 33f14e
foo: 0
Packit 33f14e
foo*: 1
Packit 33f14e
bar: 1
Packit 33f14e
foobar: 0
Packit 33f14e
baz: 1
Packit 33f14e
bar/qux: 0
Packit 33f14e
EOT
Packit 33f14e
Packit 33f14e
test-exclude -casefold in -- foo 'foo*' bar foobar baz bar/qux > 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