Blame gnulib-tests/test-exclude3.sh

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