svn commit: r224258 - in
user/gabor/tre-integration/tools/test/regex: . regmatch tests
Gabor Kovesdan
gabor at FreeBSD.org
Fri Jul 22 00:29:12 UTC 2011
Author: gabor
Date: Fri Jul 22 00:29:12 2011
New Revision: 224258
URL: http://svn.freebsd.org/changeset/base/224258
Log:
- Add support for testing with different locales
Added:
user/gabor/tre-integration/tools/test/regex/tests/bre.es_ES.ISO8859-1.tests
user/gabor/tre-integration/tools/test/regex/tests/bre.hu_HU.ISO8859-2.tests
Modified:
user/gabor/tre-integration/tools/test/regex/Makefile
user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c
user/gabor/tre-integration/tools/test/regex/tests/bre.tests
user/gabor/tre-integration/tools/test/regex/tests/ere.tests
Modified: user/gabor/tre-integration/tools/test/regex/Makefile
==============================================================================
--- user/gabor/tre-integration/tools/test/regex/Makefile Thu Jul 21 23:22:09 2011 (r224257)
+++ user/gabor/tre-integration/tools/test/regex/Makefile Fri Jul 22 00:29:12 2011 (r224258)
@@ -4,16 +4,19 @@ SUBDIR= regmatch
TESTS= bre.tests
TESTS+= ere.tests
+TESTS+= bre.hu_HU.ISO8859-2.tests
+TESTS+= bre.es_ES.ISO8859-1.tests
test: regmatch
.for t in ${TESTS}
@echo "=== Running test ${t} ==="
@flags=`grep '# *FLAGS' tests/${t} | sed 's|# *FLAGS *||g'`; \
+ locale=`grep '# *LOCALE' tests/${t} | sed 's|# *LOCALE *||g'`; \
for l in `cat tests/${t} | grep -ve '^#'`; do \
str=`echo $${l} | cut -d \; -s -f 2`; \
pat=`echo $${l} | cut -d \; -s -f 1`; \
match=`echo $${l} | cut -d \; -s -f 3`; \
- result=`env LC_ALL=C REGTEST_FLAGS=$${flags} ./regmatch/regmatch $${pat} $${str}`; \
+ result=`env LC_ALL=$${locale} REGTEST_FLAGS=$${flags} ./regmatch/regmatch $${pat} $${str}`; \
if [ "$${match}" != "$${result}" ]; then \
echo "Failed matching pattern $${pat} to string $${str}"; \
else \
Modified: user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c
==============================================================================
--- user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c Thu Jul 21 23:22:09 2011 (r224257)
+++ user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c Fri Jul 22 00:29:12 2011 (r224258)
@@ -27,6 +27,7 @@
*/
#include <err.h>
+#include <locale.h>
#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
@@ -50,6 +51,8 @@ main(int argc, char *argv[])
int cflags = 0, ret;
int eflags = REG_STARTEND;
+ setlocale(LC_ALL, "");
+
env = getenv("REGTEST_FLAGS");
if (strchr(env, 'E') != NULL)
cflags |= REG_EXTENDED;
Added: user/gabor/tre-integration/tools/test/regex/tests/bre.es_ES.ISO8859-1.tests
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/gabor/tre-integration/tools/test/regex/tests/bre.es_ES.ISO8859-1.tests Fri Jul 22 00:29:12 2011 (r224258)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+# LOCALE es_ES.ISO8859-1
+
+# Fixed string and simple expressions
+árbol;árbustoárbolcésped;((7,12))
+riñón;õãriñónôâ;((2,7))
+
+# Collating elements and equivalence classes
+# NOTE: there is not much to check here with LC_ALL=C
+[[.a.]];zzazzázz;((2,3),(5,6))
+[[=a=]];zzazzázz;((2,3),(5,6))
Added: user/gabor/tre-integration/tools/test/regex/tests/bre.hu_HU.ISO8859-2.tests
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/gabor/tre-integration/tools/test/regex/tests/bre.hu_HU.ISO8859-2.tests Fri Jul 22 00:29:12 2011 (r224258)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+# LOCALE hu_HU.ISO8859-2
+
+# Fixed string and simple expressions
+szék;asztalszéklámpa;((6,10))
Modified: user/gabor/tre-integration/tools/test/regex/tests/bre.tests
==============================================================================
--- user/gabor/tre-integration/tools/test/regex/tests/bre.tests Thu Jul 21 23:22:09 2011 (r224257)
+++ user/gabor/tre-integration/tools/test/regex/tests/bre.tests Fri Jul 22 00:29:12 2011 (r224258)
@@ -1,5 +1,7 @@
# $FreeBSD$
+# LOCALE C
+
# Fixed string and simple expressions
foo;foobarfoobar;((0,3),(6,9))
ba.;foobarfoobaz;((3,6),(9,12))
Modified: user/gabor/tre-integration/tools/test/regex/tests/ere.tests
==============================================================================
--- user/gabor/tre-integration/tools/test/regex/tests/ere.tests Thu Jul 21 23:22:09 2011 (r224257)
+++ user/gabor/tre-integration/tools/test/regex/tests/ere.tests Fri Jul 22 00:29:12 2011 (r224258)
@@ -1,6 +1,7 @@
# $FreeBSD$
# FLAGS E
+# LOCALE C
# Fixed string and simple expressions
foo;foobarfoobar;((0,3),(6,9))
More information about the svn-src-user
mailing list