revamp the other test-exclude?.sh scripts to use init.sh, too
[gnulib.git] / tests / test-exclude6.sh
index eb4f5f1..b2093d6 100755 (executable)
 # 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 $?
 
-rm -f $TMP $LIST
-exit $ERR
+# 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
+
+# normalize output
+LC_ALL=C tr -d "$cr" < out > k && mv k out
+
+compare expected out || fail=1
+
+Exit $fail