Blame gnulib-tests/test-exclude3.sh

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