* tests/Makefile.am (TESTS): Add spencer1-locale.sh. (EXTRA_DIST): Add spencer1-locale.awk. * tests/spencer1-locale.awk: New. * tests/spencer1-locale.sh: New. --- tests/Makefile.am | 4 +++- tests/spencer1-locale.awk | 30 ++++++++++++++++++++++++++++++ tests/spencer1-locale.sh | 20 ++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletions(-) create mode 100644 tests/spencer1-locale.awk create mode 100755 tests/spencer1-locale.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am index 06460bc..48d92a1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,6 +32,7 @@ TESTS = \ pcre.sh \ pcre-z \ spencer1.sh \ + spencer1-locale.sh \ status.sh \ warning.sh \ word-multi-file \ @@ -48,7 +49,8 @@ EXTRA_DIST = \ khadafy.lines \ khadafy.regexp \ spencer1.awk \ - spencer1.tests + spencer1.tests \ + spencer1-locale.awk CLEANFILES = \ spencer1.script bre.script ere.script khadafy.out patfile \ diff --git a/tests/spencer1-locale.awk b/tests/spencer1-locale.awk new file mode 100644 index 0000000..e5d3a7b --- /dev/null +++ b/tests/spencer1-locale.awk @@ -0,0 +1,30 @@ +# Copyright (C) 1988 Henry Spencer. +# Copyright (C) 2009-2010 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("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/tests/spencer1-locale.sh b/tests/spencer1-locale.sh new file mode 100755 index 0000000..62df29d --- /dev/null +++ b/tests/spencer1-locale.sh @@ -0,0 +1,20 @@ +#! /bin/sh +# Regression test for GNU grep. +# +# Copyright (C) 1988 Henry Spencer. +# Copyright (C) 2009-2010 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=.} + +failures=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -vextra_locale=$LOCALE_FR_UTF8 -f $srcdir/spencer1-locale.awk $srcdir/spencer1.tests > spencer1-locale.script + +sh spencer1-locale.script && exit $failures +exit 1 -- 1.6.6