diff tests/test-exclude6.sh @ 16081:ab4fc7286686

revamp the other test-exclude?.sh scripts to use init.sh, too * tests/test-exclude1.sh: Use init.sh. * tests/test-exclude2.sh: Likewise. * tests/test-exclude3.sh: Likewise. * tests/test-exclude4.sh: Likewise. * tests/test-exclude5.sh: Likewise. * tests/test-exclude6.sh: Likewise. * tests/test-exclude7.sh: Likewise. * tests/test-exclude8.sh: Likewise. * modules/exclude-tests (Files): List init.sh.
author Jim Meyering <meyering@redhat.com>
date Sat, 12 Nov 2011 17:12:59 +0100
parents 97fc9a21a8fb
children 8250f2777afc
line wrap: on
line diff
--- a/tests/test-exclude6.sh
+++ b/tests/test-exclude6.sh
@@ -16,26 +16,31 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-TMP=excltmp.$$
-LIST=flist.$$
-ERR=0
+. "${srcdir=.}/init.sh"; path_prepend_ .
+fail=0
 
 # Test anchored
 
-cat > $LIST <<EOT
+cat > in <<EOT
 foo*
 bar
 Baz
 EOT
 
-cat > $TMP <<EOT
+cat > expected <<EOT
 bar: 1
 foo/bar: 0
 EOT
 
-./test-exclude$EXEEXT -anchored $LIST -- bar foo/bar |
- tr -d '\015' |
- diff -c $TMP - || ERR=1
+test-exclude -anchored in -- bar foo/bar > out || exit $?
+
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac
 
-rm -f $TMP $LIST
-exit $ERR
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail