bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/9] tests: add more UTF-8 test cases


From: Paolo Bonzini
Subject: [PATCH 1/9] tests: add more UTF-8 test cases
Date: Sun, 14 Mar 2010 16:35:06 +0100

* tests/Makefile.am (TESTS): Add spencer1-locale.
(EXTRA_DIST): Add spencer1-locale.awk.
* tests/spencer1-locale.awk: New.
* tests/spencer1-locale: New.
---
 tests/Makefile.am         |    4 +++-
 tests/spencer1-locale     |   24 ++++++++++++++++++++++++
 tests/spencer1-locale.awk |   30 ++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletions(-)
 create mode 100755 tests/spencer1-locale
 create mode 100644 tests/spencer1-locale.awk

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 06460bc..9724b0d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,6 +32,7 @@ TESTS =                                               \
   pcre.sh                                      \
   pcre-z                                       \
   spencer1.sh                                  \
+  spencer1-locale                              \
   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 b/tests/spencer1-locale
new file mode 100755
index 0000000..f0b2011
--- /dev/null
+++ b/tests/spencer1-locale
@@ -0,0 +1,24 @@
+#! /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=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+fail=0
+
+# . . . and the following by Henry Spencer.
+
+${AWK-awk} -vextra_locale=$LOCALE_FR_UTF8 \
+    -f "$abs_srcdir/spencer1-locale.awk" "$abs_srcdir/spencer1.tests" \
+  > spencer1-locale.script || fail=1
+
+sh spencer1-locale.script || fail=1
+
+Exit $fail
diff --git a/tests/spencer1-locale.awk b/tests/spencer1-locale.awk
new file mode 100644
index 0000000..b22de30
--- /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"); }
-- 
1.6.6.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]