summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am5
-rw-r--r--test/test_utf8.c11
-rw-r--r--test/testc.c11
-rw-r--r--test/testu.c4
4 files changed, 16 insertions, 15 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 9643bb0..6559a77 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,7 +2,7 @@
lib_onig = ../src/libonig.la
AM_LDFLAGS = -L$(prefix)/lib
-AM_CFLAGS =
+AM_CFLAGS = -Wall -Wno-invalid-source-encoding
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(includedir)
TESTS = test_utf8 testc testp testcu
@@ -27,7 +27,8 @@ testc_LDADD = $(lib_onig)
testp_SOURCES = testc.c
testp_LDADD = $(lib_onig)
-testp_CFLAGS = -DPOSIX_TEST
+testp_CFLAGS = -DPOSIX_TEST -Wall -Wno-invalid-source-encoding
+
testcu_SOURCES = testu.c
testcu_LDADD = $(lib_onig)
diff --git a/test/test_utf8.c b/test/test_utf8.c
index a14cacc..286158d 100644
--- a/test/test_utf8.c
+++ b/test/test_utf8.c
@@ -295,6 +295,7 @@ extern int main(int argc, char* argv[])
x2("(?m:a.)", "a\n", 0, 2);
x2("(?m:.b)", "a\nb", 1, 3);
x2(".*abc", "dddabdd\nddabc", 8, 13);
+ x2(".+abc", "dddabdd\nddabcaa\naaaabc", 8, 13);
x2("(?m:.*abc)", "dddabddabc", 0, 10);
n("(?i)(?-i)a", "A");
n("(?i)(?-i:a)", "A");
@@ -1064,9 +1065,19 @@ extern int main(int argc, char* argv[])
x2("c.*\\b", "abc", 2, 3);
x2("\\b.*abc.*\\b", "abc", 0, 3);
+ n("(*FAIL)", "abcdefg");
+ n("abcd(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)", "abcdefg");
+ x2("(?:[ab]|(*MAX{2}).)*", "abcbaaccaaa", 0, 7);
+ x2("(?:(*COUNT[AB]{X})[ab]|(*COUNT[CD]{X})[cd])*(*CMP{AB,<,CD})",
+ "abababcdab", 5, 8);
+ x2("(?(?{....})123|456)", "123", 0, 3);
+ x2("(?(*FAIL)123|456)", "456", 0, 3);
+
+
e("\\u040", "@", ONIGERR_INVALID_CODE_POINT_VALUE);
e("(?<abc>\\g<abc>)", "zzzz", ONIGERR_NEVER_ENDING_RECURSION);
e("(?<=(?>abc))", "abc", ONIGERR_INVALID_LOOK_BEHIND_PATTERN);
+ e("(*FOO)", "abcdefg", ONIGERR_UNDEFINED_CALLOUT_NAME);
fprintf(stdout,
"\nRESULT SUCC: %d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n",
diff --git a/test/testc.c b/test/testc.c
index 1a60c8a..e37665a 100644
--- a/test/testc.c
+++ b/test/testc.c
@@ -2,9 +2,6 @@
* This program was generated by testconv.rb.
*/
#include "config.h"
-#ifdef ONIG_ESCAPE_UCHAR_COLLISION
-#undef ONIG_ESCAPE_UCHAR_COLLISION
-#endif
#include <stdio.h>
#ifdef POSIX_TEST
@@ -690,12 +687,6 @@ extern int main(int argc, char* argv[])
x2("^\\X$", "\x0d\x0a", 0, 2);
x2("^\\X\\X\\X$", "ab\x0d\x0a", 0, 4);
- /*
- < ifndef IGNORE_EUC_JP >
- for testcases print warnings #63
- warning: illegal character encoding in string literal [-Winvalid-source-encoding]
- */
-#ifndef IGNORE_EUC_JP
x2("", "あ", 0, 0);
x2("あ", "あ", 0, 2);
n("い", "あ");
@@ -977,8 +968,6 @@ extern int main(int argc, char* argv[])
n("\\P{Hiragana}", "ぴ");
#endif
-#endif /* IGNORE_EUC_JP */
-
fprintf(stdout,
"\nRESULT SUCC: %d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n",
nsucc, nfail, nerror, onig_version());
diff --git a/test/testu.c b/test/testu.c
index d037194..d2bb9ee 100644
--- a/test/testu.c
+++ b/test/testu.c
@@ -139,7 +139,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not)
if (r) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];
- onig_error_code_to_str(s, r, &einfo);
+ onig_error_code_to_str((UChar* )s, r, &einfo);
fprintf(err_file, "ERROR: %s\n", s);
nerror++;
return ;
@@ -150,7 +150,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not)
region, ONIG_OPTION_NONE);
if (r < ONIG_MISMATCH) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];
- onig_error_code_to_str(s, r);
+ onig_error_code_to_str((UChar* )s, r);
fprintf(err_file, "ERROR: %s\n", s);
nerror++;
return ;