- More tests (Jakub Jelinek).

This commit is contained in:
Tim Waugh 2004-12-31 16:12:38 +00:00
parent ff7a532bf5
commit 7c590e715c
2 changed files with 107 additions and 0 deletions

103
grep-2.5.1-tests.patch Normal file
View File

@ -0,0 +1,103 @@
--- grep-2.5.1/tests/Makefile.am.jj 2001-03-07 05:11:27.000000000 +0100
+++ grep-2.5.1/tests/Makefile.am 2004-12-31 11:42:41.595492300 +0100
@@ -3,7 +3,8 @@
AWK=@AWK@
TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh \
- status.sh empty.sh options.sh backref.sh file.sh
+ status.sh empty.sh options.sh backref.sh file.sh \
+ fmbtest.sh
EXTRA_DIST = $(TESTS) \
khadafy.lines khadafy.regexp \
spencer1.awk spencer1.tests \
--- grep-2.5.1/tests/fmbtest.sh.jj 2004-12-31 11:44:03.584693102 +0100
+++ grep-2.5.1/tests/fmbtest.sh 2004-12-31 13:30:23.942871250 +0100
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+: ${srcdir=.}
+
+# If cs_CZ.UTF-8 locale doesn't work, skip this test silently
+LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null | ${GREP} -q charmap.*UTF-8 \
+ || exit 77
+
+failures=0
+
+cat > csinput <<EOF
+01 Žluťoučká číše
+ČíŠE 02
+03 Z číší Čiší cosi
+04 Čí
+Še 05
+06 ČČČČČČČíšČÍŠčíš
+07 ČČČ ČČČČíšČÍŠčíšEEEE
+čAs 08
+09Čapka
+10ČaSy se měnÍ
+ČÍšE11
+Čas12
+𝇕ČÍšE𝇓13
+ŽČÍšE𝇓14
+𝇕ČÍšEŽ15
+ŽČÍšEŽ16
+ČÍšE𝇓17
+ČÍšEŽ18
+19𝇕ČÍše
+20ŽČÍše
+EOF
+cat > cspatfile <<EOF
+ČÍšE
+Čas
+EOF
+
+test1="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -F -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+if test "$test1" != "11 12 13 14 15 16 17 18"; then
+ echo "Test #1 failed: $test1"
+ failures=1
+fi
+
+test2="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -Fi -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+if test "$test2" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
+ echo "Test #2 failed: $test2"
+ failures=1
+fi
+
+test3="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -Fi -e 'ČÍšE' -e 'Čas' csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
+ echo "Test #3 failed: $test3"
+ failures=1
+fi
+
+test4="$(echo `LC_ALL=cs_CZ.UTF-8 ${GREP} -Fiw -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+if test "$test4" != "01 02 08 13 17 19"; then
+ echo "Test #4 failed: $test4"
+ failures=1
+fi
+
+# Test that --color=always prefers longer matches.
+test5="`echo 'Cosi tu ČišÍ...' \
+ | LC_ALL=cs_CZ.UTF-8 ${GREP} --color=always -Fi -e 'čiš' -e 'čiší'`"
+if echo "$test5" | LC_ALL=C ${GREP} -q 'Cosi tu .*\[.*mČišÍ.*\[.*m\.\.\.'; then
+ :
+else
+ echo "Test #5 failed: $test5"
+ failures=1
+fi
+
+exit $failures
--- grep-2.5.1/tests/Makefile.in.jj 2004-12-31 11:42:53.000000000 +0100
+++ grep-2.5.1/tests/Makefile.in 2004-12-31 11:43:36.871514505 +0100
@@ -97,7 +97,8 @@ install_sh = @install_sh@
AWK = @AWK@
TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh \
- status.sh empty.sh options.sh backref.sh file.sh
+ status.sh empty.sh options.sh backref.sh file.sh \
+ fmbtest.sh
EXTRA_DIST = $(TESTS) \
khadafy.lines khadafy.regexp \

View File

@ -13,6 +13,7 @@ Patch4: grep-2.5.1-manpage.patch
Patch5: grep-2.5.1-color.patch
Patch10: grep-2.5.1-egf-speedup.patch
Patch11: grep-2.5.1-dfa-optional.patch
Patch12: grep-2.5.1-tests.patch
URL: http://www.gnu.org/software/grep/
Prereq: /sbin/install-info
Buildroot: %{_tmppath}/%{name}-%{version}-root
@ -38,6 +39,8 @@ utility for searching through text.
%patch5 -p1 -b .color
%patch10 -p1 -b .egf-speedup
%patch11 -p1 -b .dfa-optional
%patch12 -p1 -b .tests
chmod a+x tests/fmbtest.sh
%build
[ ! -e configure ] && ./autogen.sh
@ -86,6 +89,7 @@ fi
%changelog
* Fri Dec 31 2004 Tim Waugh <twaugh@redhat.com>
- More tests (Jakub Jelinek).
- Jakub Jelinek's much improved -Fi algorithm.
- Removed bogus part of grep-2.5.1-fgrep patch.