bug-grep
[Top][All Lists]
Advanced

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

[PATCH 1/2] tests: fix skip-inducing typo in fmbtest


From: Jim Meyering
Subject: [PATCH 1/2] tests: fix skip-inducing typo in fmbtest
Date: Fri, 03 Jun 2011 11:19:13 +0200

I noticed that fmbtest was being skipped.
The first patch below fixes that by correcting a locale name typo.
The second factors out the many locale names and uses
skip_test_ "..." in place of "Exit 77".

>From d2d41a7814ecac7056c72eb02a98ab79d0773168 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 3 Jun 2011 10:25:22 +0200
Subject: [PATCH 1/2] tests: fix skip-inducing typo in fmbtest

* tests/fmbtest: Fix locale name typo (s/cz_CZ/cs_CZ/)
that would cause this test to be skipped every time.
---
 tests/fmbtest |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fmbtest b/tests/fmbtest
index 9ecbb80..28e9aed 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -7,12 +7,12 @@

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

-# If cs_CZ.UTF-8 locale doesn't work, skip this test silently
+# If cs_CZ.UTF-8 locale doesn't work, skip this test.
 LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \
   || skip_test_ 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=cs_CZ.UTF-8 grep -Eq '^[é]{2}$'
 case $? in
   0) Exit 77;;
   1) ;;
--
1.7.6.rc0.254.gf37de


>From 922c53809679940dcf5d02d197c02ebafbbb2c81 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 3 Jun 2011 10:44:52 +0200
Subject: [PATCH 2/2] tests: fmbtest: factor

* tests/fmbtest: Factor out locale-name duplication.
---
 tests/fmbtest |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/tests/fmbtest b/tests/fmbtest
index 28e9aed..b07d19d 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -7,16 +7,18 @@

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

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

 # If matching is done in single-byte mode, skip this test too
-printf 'é\n' | LC_ALL=cs_CZ.UTF-8 grep -Eq '^[é]{2}$'
+printf 'é\n' | LC_ALL=$cz grep -Eq '^[é]{2}$'
 case $? in
-  0) Exit 77;;
+  0) skip_test_ this test works only in multibyte mode;;
   1) ;;
-  *) Exit 1;;
+  *) framework_failure_ grep exited with unexpected status $? ;;
 esac

 failures=0
@@ -50,21 +52,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=$cz 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=$cz 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=$cz 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 +74,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=$cz 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,7 +84,7 @@ 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ší')"
+        | LC_ALL=$cz 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
@@ -93,7 +95,7 @@ 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š')"
+        | LC_ALL=$cz 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
@@ -105,7 +107,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=$cz 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"
--
1.7.6.rc0.254.gf37de



reply via email to

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