diff options
Diffstat (limited to '')
-rwxr-xr-x | src/grep/tests/spencer1 | 21 | ||||
-rwxr-xr-x | src/grep/tests/spencer1-locale | 23 | ||||
-rw-r--r-- | src/grep/tests/spencer1-locale.awk | 32 | ||||
-rw-r--r-- | src/grep/tests/spencer1.awk | 22 | ||||
-rw-r--r-- | src/grep/tests/spencer1.tests | 144 |
5 files changed, 242 insertions, 0 deletions
diff --git a/src/grep/tests/spencer1 b/src/grep/tests/spencer1 new file mode 100755 index 0000000..56eaeda --- /dev/null +++ b/src/grep/tests/spencer1 @@ -0,0 +1,21 @@ +#! /bin/sh +# Regression test for GNU grep. +# Copyright (C) 1988 Henry Spencer. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -f $abs_top_srcdir/tests/spencer1.awk \ + $abs_top_srcdir/tests/spencer1.tests > spencer1.script || fail=1 + +. ./spencer1.script || fail=1 + +Exit 1 diff --git a/src/grep/tests/spencer1-locale b/src/grep/tests/spencer1-locale new file mode 100755 index 0000000..6a3d58a --- /dev/null +++ b/src/grep/tests/spencer1-locale @@ -0,0 +1,23 @@ +#! /bin/sh +# Regression test for GNU grep. +# +# Copyright (C) 1988 Henry Spencer. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -v extra_locale=$LOCALE_FR_UTF8 \ + -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \ + > spencer1-locale.script || fail=1 + +${re_shell-${SHELL-sh}} spencer1-locale.script || fail=1 + +Exit $fail diff --git a/src/grep/tests/spencer1-locale.awk b/src/grep/tests/spencer1-locale.awk new file mode 100644 index 0000000..36a2c5b --- /dev/null +++ b/src/grep/tests/spencer1-locale.awk @@ -0,0 +1,32 @@ +# Copyright (C) 1988 Henry Spencer. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +BEGIN { + FS = "@"; + printf ("failures=0\n"); +} + +$0 !~ /^#/ && NF == 3 { + test("en_US.UTF-8") + test("ru_RU.KOI8-R") + test("fr_FR.ISO-8859-1") + test("zh_CN") + if (extra_locale != "") { + test(extra_locale) + } +} + +function test(locale) +{ + printf ("status=$(echo '%s'| { LC_ALL=%s grep -E -e '%s' >/dev/null 2>&1 ; echo $?; })\n",$3, locale, $2); + printf ("if test $status -ne %s ; then\n", $1); + printf ("\techo Spencer test \\#%d failed \\(%s\\)\n", ++n, locale); + printf ("\tfailures=1\n"); + printf ("fi\n"); +} + +END { printf ("exit $failures\n"); } diff --git a/src/grep/tests/spencer1.awk b/src/grep/tests/spencer1.awk new file mode 100644 index 0000000..6b9d3ee --- /dev/null +++ b/src/grep/tests/spencer1.awk @@ -0,0 +1,22 @@ +# Copyright (C) 1988 Henry Spencer. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +BEGIN { + FS = "@"; + printf ("failures=0\n"); +} + +$0 !~ /^#/ && NF == 3 { +# printf ("status=$(echo '%s'| { grep -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2); + printf ("status=$(echo '%s'| { grep -E -e '%s' >/dev/null 2>&1 ; echo $?; })\n",$3, $2); + printf ("if test $status -ne %s ; then\n", $1); + printf ("\techo Spencer test \\#%d failed\n", ++n); + printf ("\tfailures=1\n"); + printf ("fi\n"); +} + +END { printf ("exit $failures\n"); } diff --git a/src/grep/tests/spencer1.tests b/src/grep/tests/spencer1.tests new file mode 100644 index 0000000..50581e8 --- /dev/null +++ b/src/grep/tests/spencer1.tests @@ -0,0 +1,144 @@ +0@abc@abc +1@abc@xbc +1@abc@axc +1@abc@abx +0@abc@xabcy +0@abc@ababc +0@ab*c@abc +0@ab*bc@abc +0@ab*bc@abbc +0@ab*bc@abbbbc +0@ab+bc@abbc +1@ab+bc@abc +1@ab+bc@abq +0@ab+bc@abbbbc +0@ab?bc@abbc +0@ab?bc@abc +1@ab?bc@abbbbc +0@ab?c@abc +0@^abc$@abc +1@^abc$@abcc +0@^abc@abcc +1@^abc$@aabc +0@abc$@aabc +0@^@abc +0@$@abc +0@a.c@abc +0@a.c@axc +0@a.*c@axyzc +1@a.*c@axyzd +1@a[bc]d@abc +0@a[bc]d@abd +1@a[b-d]e@abd +0@a[b-d]e@ace +0@a[b-d]@aac +0@a[-b]@a- +0@a[b-]@a- +2@a[b-a]@- +2@a[]b@- +2@a[@- +0@a]@a] +0@a[]]b@a]b +0@a[^bc]d@aed +1@a[^bc]d@abd +0@a[^-b]c@adc +1@a[^-b]c@a-c +1@a[^]b]c@a]c +0@a[^]b]c@adc +0@ab|cd@abc +0@ab|cd@abcd +0@()ef@def +0@()*@- +1@*a@- +0@^*@- +0@$*@- +2@(*)b@-@TO CORRECT +1@$b@b +2@a\@- +0@a\(b@a(b +0@a\(*b@ab +0@a\(*b@a((b +1@a\x@a\x +1@abc)@- +2@(abc@- +0@((a))@abc +0@(a)b(c)@abc +0@a+b+c@aabbabc +0@a**@- +0@a*?@- +0@(a*)*@- +0@(a*)+@- +0@(a|)*@- +0@(a*|b)*@- +0@(a+|b)*@ab +0@(a+|b)+@ab +0@(a+|b)?@ab +0@[^ab]*@cde +0@(^)*@- +0@(ab|)*@- +2@)(@- +1@abc@ +1@abc@ +0@a*@ +0@([abc])*d@abbbcd +0@([abc])*bcd@abcd +0@a|b|c|d|e@e +0@(a|b|c|d|e)f@ef +0@((a*|b))*@- +0@abcd*efg@abcdefg +0@ab*@xabyabbbz +0@ab*@xayabbbz +0@(ab|cd)e@abcde +0@[abhgefdc]ij@hij +1@^(ab|cd)e@abcde +0@(abc|)ef@abcdef +0@(a|b)c*d@abcd +0@(ab|ab*)bc@abc +0@a([bc]*)c*@abc +0@a([bc]*)(c*d)@abcd +0@a([bc]+)(c*d)@abcd +0@a([bc]*)(c+d)@abcd +0@a[bcd]*dcdcde@adcdcde +1@a[bcd]+dcdcde@adcdcde +0@(ab|a)b*c@abc +0@((a)(b)c)(d)@abcd +0@[A-Za-z_][A-Za-z0-9_]*@alpha +0@^a(bc+|b[eh])g|.h$@abh +0@(bc+d$|ef*g.|h?i(j|k))@effgz +0@(bc+d$|ef*g.|h?i(j|k))@ij +1@(bc+d$|ef*g.|h?i(j|k))@effg +1@(bc+d$|ef*g.|h?i(j|k))@bcdd +0@(bc+d$|ef*g.|h?i(j|k))@reffgz +1@((((((((((a))))))))))@- +0@(((((((((a)))))))))@a +0@ca{0,0}b@cb +1@ca{0,0}b@cab +0@ca{0,1}b@cb +0@ca{0,1}b@cab +1@ca{0,1}b@caab +1@ca{1,2}b@cb +0@ca{1,2}b@cab +0@ca{1,2}b@caab +1@ca{1,2}b@caaab +1@multiple words of text@uh-uh +0@multiple words@multiple words, yeah +0@(.*)c(.*)@abcde +1@\((.*),@(.*)\) +1@[k]@ab +0@abcd@abcd +0@a(bc)d@abcd +0@a[-]?c@ac +0@a[]?c@ac +0@(....).*\1@beriberi +0@(^|\B)a@abc +0@(^|\B)a@xyzabc +1@(^|\B)a@xyz abc +0@^a|\Ba@abc +0@^a|\Ba@xyzabc +1@^a|\Ba@xyz abc +0@(^|\>)a@abc +1@(^|\>)a@xyzabc +1@(^|\>)a@xyz abc +0@^a|\>a@abc +1@^a|\>a@xyzabc +1@^a|\>a@xyz abc |