summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-11-11 22:34:41 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2014-11-11 22:35:20 -0800
commitd48e658e03a70ff648801cbea698c11abff80016 (patch)
tree931d09dc99108e513f36a231e3a4dbce5d784e32
parent323f8b3614ab2e450e2839b3d0a1d260097f2e6b (diff)
downloadgrep-d48e658e03a70ff648801cbea698c11abff80016.tar.gz
tests: port to Darwin
The 'sed' command 's/.//' does not delete all bytes in the C locale. Problem reported by Nelson H. F. Beebe. * tests/fmbtest: Don't assume that sed treats bytes with the top bit set as valid characters in the C locale, as this is not true for Darwin. Use the cs_CZ.UTF-8 locale instead, and simplify the sed script.
-rwxr-xr-xtests/fmbtest21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/fmbtest b/tests/fmbtest
index bec5403b..bfaf607f 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -52,30 +52,30 @@ EOF
for mode in F G E; do
-test1="$(echo $(LC_ALL=$cz grep -${mode} -f cspatfile csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
+test1=$(echo $(LC_ALL=$cz; export LC_ALL
+ grep -${mode} -f cspatfile csinput | sed 's/[^0-9]/ /g'))
if test "$test1" != "11 12 13 14 15 16 17 18"; then
echo "Test #1 ${mode} failed: $test1"
failures=1
fi
-test2="$(echo $(LC_ALL=$cz grep -${mode}i -f cspatfile csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
+test2=$(echo $(LC_ALL=$cz; export LC_ALL
+ grep -${mode}i -f cspatfile csinput | sed 's/[^0-9]/ /g'))
if test "$test2" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #2 ${mode} failed: $test2"
failures=1
fi
-test3="$(echo $(LC_ALL=$cz grep -${mode}i -e 'ČÍšE' -e 'Čas' csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
+test3=$(echo $(LC_ALL=$cz; export LC_ALL
+ grep -${mode}i -e 'ČÍšE' -e 'Čas' csinput | sed 's/[^0-9]/ /g'))
if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #3 ${mode} failed: $test3"
failures=1
fi
# Skip the next test - known to fail. TAA.
-#test4="$(echo $(LC_ALL=$cz grep -${mode}iw -f cspatfile csinput \
-# | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
+#test4=$(echo $(LC_ALL=$cz; export LC_ALL
+# grep -${mode}iw -f cspatfile csinput | sed 's/[^0-9]/ /g'))
#if test "$test4" != "01 02 08 13 17 19"; then
# echo "Test #4 ${mode} failed: $test4"
# failures=1
@@ -113,8 +113,9 @@ done
for mode in G E; do
-test8="$(echo $(LC_ALL=$cz grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
+test8=$(echo $(LC_ALL=$cz; export LC_ALL
+ grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' csinput |
+ sed 's/[^0-9]/ /g'))
if test "$test8" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #8 ${mode} failed: $test8"
failures=1