summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-03-07 20:07:30 +0100
committerJim Meyering <meyering@redhat.com>2010-03-12 16:25:24 +0100
commitdaa5786d8f91f3b7fd9167b28fc040131d8c650d (patch)
treec1d0171bbc6827a2e7734f330084d93f910f10f7 /tests
parentbafa1341db643225c2421ecca90353e556dedae5 (diff)
downloadgrep-daa5786d8f91f3b7fd9167b28fc040131d8c650d.tar.gz
tests: add test cases for dfaexec bug
* tests/dfaexec-multibyte: New test. * tests/Makefile.am (TESTS): Add it. Reported by Paolo Bonzini in http://bugzilla.redhat.com/544407 and http://bugzilla.redhat.com/544406 .
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/dfaexec-multibyte30
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1f54ec7e..06460bc5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,6 +19,7 @@ TESTS = \
bre.sh \
case-fold-char-class \
case-fold-char-type \
+ dfaexec-multibyte \
empty.sh \
ere.sh \
file.sh \
diff --git a/tests/dfaexec-multibyte b/tests/dfaexec-multibyte
new file mode 100644
index 00000000..47db42bc
--- /dev/null
+++ b/tests/dfaexec-multibyte
@@ -0,0 +1,30 @@
+#!/bin/sh
+# This would fail for grep-2.5.3
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+printf 'aa\n' > exp-aa || framework_failure
+printf 'ab\n' > exp-ab || framework_failure
+printf '1 2 3\n' > exp-123 || framework_failure
+
+fail=0
+
+for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
+ LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp-aa > out || fail=1
+ compare out exp-aa || fail=1
+
+ LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp-aa > out || fail=1
+ compare out exp-aa || fail=1
+
+ LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp-ab > out || fail=1
+ compare out exp-ab || fail=1
+
+ LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp-ab > out || fail=1
+ compare out exp-ab || fail=1
+
+ LC_ALL=$LOC grep -E '^([[:digit:]]+[[:space:]]+){2}' < exp-123 > out || fail=1
+ compare out exp-123 || fail=1
+
+done
+
+Exit $fail