summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-03-26 11:21:11 +0100
committerJim Meyering <meyering@redhat.com>2010-03-26 11:25:43 +0100
commitd06078aef747928c4c4f1a0a3091bb262bc96dcf (patch)
tree1b90247438be1e87810f89237d38dc8d3da4ffe4 /tests
parent09a90757cd10899988c9ae1984debcfb9f99ec8c (diff)
downloadgrep-d06078aef747928c4c4f1a0a3091bb262bc96dcf.tar.gz
tests: convert foad1.sh to use init.sh
This fixes a spurious test failure when "make check" is run with certain envvars set, e.g., "make check GREP_COLOR=always" * tests/foad1.sh: Use init.sh and adapt accordingly: Use "grep", not ${GREP}. Test VERBOSE against "yes", not "1", to be consistent with init.sh. Use Exit, not exit. Reported by Nelson H. F. Beebe.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/foad1.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/foad1.sh b/tests/foad1.sh
index 68acc777..150c2b0d 100755
--- a/tests/foad1.sh
+++ b/tests/foad1.sh
@@ -9,9 +9,9 @@
#
# This set of tests was started by Julian Foad.
-: ${GREP=../src/grep}
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
-: ${VERBOSE=} # empty or "1"
failures=0
# grep_test INPUT EXPECTED_OUTPUT PATTERN_AND_OPTIONS...
@@ -23,9 +23,9 @@ grep_test ()
INPUT="$1"
EXPECT="$2"
shift 2
- OUTPUT=`printf %s "$INPUT" | tr "/" "\n" | "$GREP" "$@" | tr "\n" "/"`
- if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "1"; then
- echo "Testing: $GREP $@"
+ OUTPUT=`printf %s "$INPUT" | tr "/" "\n" | grep "$@" | tr "\n" "/"`
+ if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "yes"; then
+ echo "Testing: grep $@"
test "$LC_ALL" != C && test "$LC_ALL" != "" && echo " LC_ALL: \"$LC_ALL\""
echo " input: \"$INPUT\""
echo " output: \"$OUTPUT\""
@@ -139,12 +139,12 @@ grep_test "$x3" "$y3" -E -w --color=always bc
grep_test "$x3" "$y3" -F -w --color=always bc
# Skip the rest of the tests - known to fail. TAA.
-exit $failures
+Exit $failures
# The rest of this file is meant to be executed under this locale.
LC_ALL=cs_CZ.UTF-8; export LC_ALL
# If the UTF-8 locale doesn't work, skip these tests silently.
-locale -k LC_CTYPE 2>/dev/null | "${GREP}" -q "charmap.*UTF-8" || exit $failures
+locale -k LC_CTYPE 2>/dev/null | grep -q "charmap.*UTF-8" || Exit $failures
# Test character class erroneously matching a '[' character.
grep_test "[/" "" "[[:alpha:]]" -E
@@ -202,4 +202,4 @@ done
# Insert them before LC_ALL is set above to avoid this.
# Leave this comment last.
-exit $failures
+Exit $failures