bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: tests: convert fmbtest.sh to use init.sh


From: Jim Meyering
Subject: FYI: tests: convert fmbtest.sh to use init.sh
Date: Sun, 28 Mar 2010 17:45:20 +0200

Mostly mechanical...

>From 26e1d674a3e2843461de29f35975f9f1a2bd4f89 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 28 Mar 2010 15:05:37 +0200
Subject: [PATCH 1/2] tests: convert fmbtest.sh to use init.sh

* tests/fmbtest.sh: Use init.sh and adapt accordingly:
Use "grep", not ${GREP}.  Use Exit, not exit.
---
 tests/fmbtest.sh |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/tests/fmbtest.sh b/tests/fmbtest.sh
index 93ce2ae..8a00b2a 100755
--- a/tests/fmbtest.sh
+++ b/tests/fmbtest.sh
@@ -6,17 +6,18 @@
 # notice and this notice are preserved.

 : ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src

 # If cs_CZ.UTF-8 locale doesn't work, skip this test silently
-LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null | ${GREP} -q charmap.*UTF-8 \
-  || exit 77
+LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \
+  || skip_ this system lacks the cs_CZ.UTF-8 locale

 # If matching is done in single-byte mode, skip this test too
-printf 'é\n' | LC_ALL=cz_CZ.UTF-8 ${GREP} -Eq '^[é]{2}$'
+printf 'é\n' | LC_ALL=cz_CZ.UTF-8 grep -Eq '^[é]{2}$'
 case $? in
-  0) exit 77;;
+  0) Exit 77;;
   1) ;;
-  *) exit 1;;
+  *) Exit 1;;
 esac

 failures=0
@@ -50,21 +51,21 @@ EOF

 for mode in F G E; do

-test1="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -${mode} -f cspatfile csinput \
+test1="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode} -f cspatfile csinput \
               | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
 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=cs_CZ.UTF-8 ${GREP} -${mode}i -f cspatfile csinput \
+test2="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -f cspatfile csinput \
               | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
 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=cs_CZ.UTF-8 ${GREP} -${mode}i -e 'ČÍšE' -e 'Čas' csinput 
\
+test3="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'ČÍšE' -e 'Čas' csinput \
               | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
 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"
@@ -72,7 +73,7 @@ if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 
19 20"; then
 fi

 # Skip the next test - known to fail. TAA.
-#test4="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -${mode}iw -f cspatfile csinput \
+#test4="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}iw -f cspatfile csinput \
 #             | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
 #if test "$test4" != "01 02 08 13 17 19"; then
 #  echo "Test #4 ${mode} failed: $test4"
@@ -82,8 +83,8 @@ fi
 # Test that --color=always does not depend on individual pattern order within 
the pattern
 # list, and that a longer match is preferred to a shorter one starting at the 
same point.
 test6="`echo 'Cosi tu ČišÍ...' \
-       | LC_ALL=cs_CZ.UTF-8 ${GREP} --color=always -${mode}i -e 'čiš' -e 
'čiší'`"
-if echo "$test6" | LC_ALL=C ${GREP} -q 'Cosi tu 
.*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
+       | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'čiš' -e 'čiší'`"
+if echo "$test6" | LC_ALL=C grep -q 'Cosi tu 
.*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
   :
 else
   echo "Test #6 ${mode} failed: $test6"
@@ -93,8 +94,8 @@ fi
 # Test that --color=always does not depend on individual pattern order within 
the pattern
 # list, and that a longer match is preferred to a shorter one starting at the 
same point.
 test7="`echo 'Cosi tu ČišÍ...' \
-       | LC_ALL=cs_CZ.UTF-8 ${GREP} --color=always -${mode}i -e 'čiší' -e 
'čiš'`"
-if echo "$test7" | LC_ALL=C ${GREP} -q 'Cosi tu 
.*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
+       | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'čiší' -e 'čiš'`"
+if echo "$test7" | LC_ALL=C grep -q 'Cosi tu 
.*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
   :
 else
   echo "Test #7 ${mode} failed: $test7"
@@ -105,7 +106,7 @@ done

 for mode in G E; do

-test8="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -${mode}i -e 'Č.šE' -e 'Č[a-f]s' 
csinput \
+test8="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' 
csinput \
               | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
 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"
@@ -114,4 +115,4 @@ fi

 done

-exit $failures
+Exit $failures
--
1.7.0.3.448.g82eeb


>From 7a6e488e4cb0c08b230a672f7fff07e0ea5c9b88 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 28 Mar 2010 15:06:09 +0200
Subject: [PATCH 2/2] tests: rename: fmbtest.sh -> fmbtest

* tests/fmbtest.sh: Rename to ...
* tests/fmbtest: ...this, dropping the .sh suffix.
* tests/Makefile.am (TESTS): Reflect renaming.
---
 tests/Makefile.am             |    2 +-
 tests/{fmbtest.sh => fmbtest} |    0
 2 files changed, 1 insertions(+), 1 deletions(-)
 rename tests/{fmbtest.sh => fmbtest} (100%)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index efbbcc0..f9ba21b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,7 +30,7 @@ TESTS =                                               \
   euc-mb                                       \
   fedora                                       \
   file.sh                                      \
-  fmbtest.sh                                   \
+  fmbtest                                      \
   foad1                                                \
   help-version                                 \
   include-exclude                              \
diff --git a/tests/fmbtest.sh b/tests/fmbtest
similarity index 100%
rename from tests/fmbtest.sh
rename to tests/fmbtest
--
1.7.0.3.448.g82eeb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]