Blame gnulib-tests/test-exclude3.sh

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