bug-grep
[Top][All Lists]
Advanced

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

[PATCH] tests: use get-mb-cur-max in char-class-multibyte


From: Paolo Bonzini
Subject: [PATCH] tests: use get-mb-cur-max in char-class-multibyte
Date: Wed, 31 Mar 2010 10:19:24 +0200

* tests/char-class-multibyte: Use get-mb-cur-max to detect UTF-8 support.
Rewrite previous locale detection code as a grep test.
---
 tests/char-class-multibyte |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/char-class-multibyte b/tests/char-class-multibyte
index d7ed399..825e3ad 100644
--- a/tests/char-class-multibyte
+++ b/tests/char-class-multibyte
@@ -1,11 +1,12 @@
 #!/bin/sh
 # This would segfault for grep-2.6
 : ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ ../src
+. "$srcdir/init.sh"; path_prepend_ . ../src
 
-if printf '\xc3\n' | LC_ALL=en_US.UTF-8 grep -q '[é]'; then
-  skip_ UTF-8 matching seems not to work
-fi
+case $(get-mb-cur-max en_US.UTF-8) in
+  [3456]) ;;
+  *) skip_ 'UTF-8 locale not found' ;;
+esac
 
 printf 'é\n'      > exp1 || framework_failure_
 fail=0
@@ -24,4 +25,10 @@ for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
   compare $out exp2 || fail=1
 done
 
+for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
+  out=out3-$LOC
+  printf '\xc3\n' | LC_ALL=$LOC grep '[é]' > $out
+  test $? = 1 || fail=1
+done
+
 Exit $fail
-- 
1.6.6.1





reply via email to

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