Mercurial > hg > octave-kai > gnulib-hg
annotate tests/test-exclude8.sh @ 16201:8250f2777afc
maint: update all copyright year number ranges
Run "make update-copyright".
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Sun, 01 Jan 2012 10:04:58 +0100 |
parents | ab4fc7286686 |
children | e542fd46ad6f |
rev | line source |
---|---|
13320
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
1 #! /bin/sh |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
2 # Test suite for exclude. |
16201
8250f2777afc
maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents:
16081
diff
changeset
|
3 # Copyright (C) 2010-2012 Free Software Foundation, Inc. |
13320
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
4 # This file is part of the GNUlib Library. |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
5 # |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
7 # it under the terms of the GNU General Public License as published by |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
8 # the Free Software Foundation; either version 3 of the License, or |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
9 # (at your option) any later version. |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
10 # |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
14 # GNU General Public License for more details. |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
15 # |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU General Public License |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
18 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
19 . "${srcdir=.}/init.sh"; path_prepend_ . |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
20 fail=0 |
13320
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
21 |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
22 # Test escaped metacharacters. |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
23 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
24 cat > in <<'EOT' |
13320
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
25 f\*e |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
26 b[a\*]r |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
27 EOT |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
28 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
29 cat > expected <<'EOT' |
13320
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
30 f*e: 1 |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
31 file: 0 |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
32 bar: 1 |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
33 EOT |
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
34 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
35 test-exclude -wildcards in -- 'f*e' 'file' 'bar' > out || exit $? |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
36 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
37 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
38 # does not understand '\r'. |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
39 case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac |
13320
4e283fd1efe9
exclude: Unescape hashed patterns in wildcard mode.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
40 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
41 # normalize output |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
42 LC_ALL=C tr -d "$cr" < out > k && mv k out |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
43 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
44 compare expected out || fail=1 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
45 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
46 Exit $fail |