bug-grep
[Top][All Lists]
Advanced

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

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


From: Jim Meyering
Subject: Re: [PATCH] tests: use get-mb-cur-max in char-class-multibyte
Date: Wed, 31 Mar 2010 11:22:51 +0200

Paolo Bonzini wrote:
> * 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

This looks fine.

However, you might want to consider adding a require_en_utf8_ function
in tests/init.cfg that does path_prepend_ and the test below.
That would have the advantage of factoring out this common
code from a few tests, as well as keeping the new path-setting
"close" to the code that requires it.

You're welcome to commit this as-is.
At worst, I'll factor later.

> -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




reply via email to

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