bug-grep
[Top][All Lists]
Advanced

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

two test improvements


From: Jim Meyering
Subject: two test improvements
Date: Thu, 15 Sep 2011 14:09:10 +0200

In an effort to segregate patches, I've just pushed
the two test-related changes:

>From 86ff96a57b2e9aa66096839cc39e1404a3f954af Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 7 Apr 2010 15:11:02 +0200
Subject: [PATCH 1/2] tests: make fmbtest explain (to stderr, not log) why it
 is skipped

* tests/fmbtest: Use skip_ and fail_ to give better diagnostics.
---
 tests/fmbtest |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fmbtest b/tests/fmbtest
index b07d19d..4e4ee89 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -16,9 +16,9 @@ LC_ALL=$cz locale -k LC_CTYPE 2>/dev/null | grep -q 
charmap.*UTF-8 \
 # If matching is done in single-byte mode, skip this test too
 printf 'é\n' | LC_ALL=$cz grep -Eq '^[é]{2}$'
 case $? in
-  0) skip_test_ this test works only in multibyte mode;;
+  0) skip_ "built without multi-byte support";;
   1) ;;
-  *) framework_failure_ grep exited with unexpected status $? ;;
+  *) fail_ "unexpected exit status: $?";;
 esac

 failures=0
--
1.7.7.rc0.362.g5a14


>From 46e5cc6fb27886af532e6f34c4491bd533637f7c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 2 May 2011 12:22:34 +0200
Subject: [PATCH 2/2] tests: skip tests that require MBS support

* tests/init.cfg (require_compiled_in_MB_support): New function.
* tests/char-class-multibyte: Use it here, since this test cannot
succeed without MBS support.
* tests/equiv-classes: Likewise.
* tests/euc-mb: Likewise.
* tests/fgrep-infloop: Likewise.
* tests/init.cfg: Likewise.
* tests/prefix-of-multibyte: Likewise.
* tests/turkish-I: Likewise.
* tests/sjis-mb: Likewise.
---
 tests/char-class-multibyte |    1 +
 tests/equiv-classes        |    1 +
 tests/euc-mb               |    2 ++
 tests/fgrep-infloop        |    1 +
 tests/init.cfg             |    7 +++++++
 tests/prefix-of-multibyte  |    1 +
 tests/sjis-mb              |    1 +
 tests/turkish-I            |    1 +
 8 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tests/char-class-multibyte b/tests/char-class-multibyte
index 07d9620..88b8fa0 100755
--- a/tests/char-class-multibyte
+++ b/tests/char-class-multibyte
@@ -3,6 +3,7 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src

 require_en_utf8_locale_
+require_compiled_in_MB_support

 printf 'é\n'      > exp1 || framework_failure_
 fail=0
diff --git a/tests/equiv-classes b/tests/equiv-classes
index de38d95..940efa4 100755
--- a/tests/equiv-classes
+++ b/tests/equiv-classes
@@ -4,6 +4,7 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src

 require_en_utf8_locale_
+require_compiled_in_MB_support

 LC_ALL=en_US.UTF-8
 export LC_ALL
diff --git a/tests/euc-mb b/tests/euc-mb
index e6154f3..ee5ee61 100755
--- a/tests/euc-mb
+++ b/tests/euc-mb
@@ -7,6 +7,8 @@
 # Add "." to PATH for the use of get-mb-cur-max.
 path_prepend_ .

+require_compiled_in_MB_support
+
 locale=ja_JP.EUC-JP

 make_input () {
diff --git a/tests/fgrep-infloop b/tests/fgrep-infloop
index 908b788..7ef8297 100755
--- a/tests/fgrep-infloop
+++ b/tests/fgrep-infloop
@@ -4,6 +4,7 @@

 require_en_utf8_locale_
 require_timeout_
+require_compiled_in_MB_support

 encode() { echo "$1" | tr ABC '\357\274\241'; }

diff --git a/tests/init.cfg b/tests/init.cfg
index f6ead9c..25e87f3 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -78,3 +78,10 @@ require_ru_RU_koi8_r()
     *) skip_test_ 'ru_RU.KOI8-R locale not found' ;;
   esac
 }
+
+require_compiled_in_MB_support()
+{
+  require_en_utf8_locale_
+  printf 'é' | LC_ALL=en_US.UTF-8 grep '[[:lower:]]' \
+    || skip_ this test requires MBS support
+}
diff --git a/tests/prefix-of-multibyte b/tests/prefix-of-multibyte
index 05045b0..851e1f6 100755
--- a/tests/prefix-of-multibyte
+++ b/tests/prefix-of-multibyte
@@ -3,6 +3,7 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src

 require_en_utf8_locale_
+require_compiled_in_MB_support

 encode() { echo "$1" | tr ABC '\357\274\241'; }

diff --git a/tests/sjis-mb b/tests/sjis-mb
index 07c9a9a..b5a18dc 100755
--- a/tests/sjis-mb
+++ b/tests/sjis-mb
@@ -8,6 +8,7 @@
 # Add "." to PATH for the use of get-mb-cur-max.
 path_prepend_ .

+require_compiled_in_MB_support
 require_timeout_

 locale=ja_JP.SHIFT_JIS
diff --git a/tests/turkish-I b/tests/turkish-I
index ac536c4..d941ed1 100755
--- a/tests/turkish-I
+++ b/tests/turkish-I
@@ -19,6 +19,7 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src

 require_en_utf8_locale_
+require_compiled_in_MB_support

 fail=0

--
1.7.7.rc0.362.g5a14



reply via email to

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