diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-11-20 20:31:01 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-11-20 20:31:33 -0800 |
commit | 9dc7483239001d4cd1fcdbacd632c7e93187c871 (patch) | |
tree | 5a33f7ed49e1b2b42a01f76e3dbbf4836ed607b6 /tests/unibyte-bracket-expr | |
parent | a78acea4e924ffd377e42e93e06d0c7a489f2f21 (diff) | |
download | grep-9dc7483239001d4cd1fcdbacd632c7e93187c871.tar.gz |
tests: check for unibyte French range bug
Problem reported by Stephane Chazelas (Bug#24973).
This bug was fixed in Gnulib.
* NEWS: Document the fix.
* tests/init.cfg (require_ru_RU_koi8_r): Remove.
* tests/unibyte-bracket-expr: Add a test for the bug.
Call get-mb-cur-max directly instead of bothering with
require_ru_RU_koi8_r.
Diffstat (limited to 'tests/unibyte-bracket-expr')
-rwxr-xr-x | tests/unibyte-bracket-expr | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/tests/unibyte-bracket-expr b/tests/unibyte-bracket-expr index 68c475ce..85aff1ca 100755 --- a/tests/unibyte-bracket-expr +++ b/tests/unibyte-bracket-expr @@ -1,9 +1,4 @@ #!/bin/sh -# Exercise a DFA range bug that arises only with a unibyte encoding -# for which the wide-char-to-single-byte mapping is nontrivial. -# E.g., the regexp, [C] would fail to match C in a unibyte locale like -# ru_RU.KOI8-R for any C whose wide-char representation differed from -# its single-byte equivalent. # Copyright (C) 2011-2016 Free Software Foundation, Inc. @@ -21,23 +16,42 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . "${srcdir=.}/init.sh"; path_prepend_ ../src -require_ru_RU_koi8_r -LC_ALL=ru_RU.KOI8-R -export LC_ALL - -fail=0 - -i=128 -while :; do - in=in-$i - octal=$(printf '%03o' $i) - b=$(printf "\\$octal") - echo "$b" > $in || framework_failure_ - grep "[$b]" $in > out || fail=1 - compare out $in || fail=1 - - test $i = 255 && break - i=$(expr $i + 1) + +# Add "." to PATH for the use of get-mb-cur-max. +path_prepend_ . + +# Exercise a DFA range bug that arises only with a unibyte encoding +# for which the wide-char-to-single-byte mapping is nontrivial. +# E.g., the regexp, [C] would fail to match C in a unibyte locale like +# ru_RU.KOI8-R for any C whose wide-char representation differed from +# its single-byte equivalent. + +case $(get-mb-cur-max ru_RU.KOI8-R) in + 1) + fail=0 + + i=128 + while :; do + in=in-$i + octal=$(printf '%03o' $i) + b=$(printf "\\$octal") + echo "$b" > $in || framework_failure_ + LC_ALL=ru_RU.KOI8-R grep "[$b]" $in > out || fail=1 + compare out $in || fail=1 + + test $i = 255 && break + i=$(expr $i + 1) + done;; +esac + +# Exercise a DFA range bug where '[d-f]' did not match accented 'e' in a +# unibyte French locale. + +for locale in fr_FR.iso88591 fr_FR.iso885915@euro fr_FR.ISO8859-1; do + case $(get-mb-cur-max $locale) in + 1) + printf '\351\n' | LC_ALL=$locale grep '[d-f]' || fail=1;; + esac done Exit $fail |