Skip to content

Commit

Permalink
fix #305: e() function bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kkos committed Jul 1, 2024
1 parent ab444e0 commit ec9d8c8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/test_back.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* test_back.c
* Copyright (c) 2020-2021 K.Kosako
* Copyright (c) 2020-2024 K.Kosako
*/
#ifdef ONIG_ESCAPE_UCHAR_COLLISION
#undef ONIG_ESCAPE_UCHAR_COLLISION
Expand Down Expand Up @@ -64,7 +64,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not,
r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)),
(UChar* )(str + SLEN(str)), (UChar* )str,
region, ONIG_OPTION_NONE);
if (r < ONIG_MISMATCH) {
if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];

if (error_no == 0) {
Expand Down
4 changes: 2 additions & 2 deletions test/test_options.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* test_options.c
* Copyright (c) 2020-2021 K.Kosako
* Copyright (c) 2020-2024 K.Kosako
*/
#ifdef ONIG_ESCAPE_UCHAR_COLLISION
#undef ONIG_ESCAPE_UCHAR_COLLISION
Expand Down Expand Up @@ -64,7 +64,7 @@ static void xx(OnigOptionType options, char* pattern, char* str,
r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)),
(UChar* )str, (UChar* )(str + SLEN(str)),
region, options);
if (r < ONIG_MISMATCH) {
if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];

if (error_no == 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/test_syntax.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not,
r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)),
(UChar* )str, (UChar* )(str + SLEN(str)),
region, ONIG_OPTION_NONE);
if (r < ONIG_MISMATCH) {
if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];

if (error_no == 0) {
Expand Down
6 changes: 3 additions & 3 deletions test/test_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void xx(char* pattern, char* str, int from, int to, int mem, int not,
r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)),
(UChar* )str, (UChar* )(str + SLEN(str)),
region, ONIG_OPTION_NONE);
if (r < ONIG_MISMATCH) {
if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) {
char s[ONIG_MAX_ERROR_MESSAGE_LEN];

if (error_no == 0) {
Expand Down Expand Up @@ -1648,8 +1648,8 @@ extern int main(int argc, char* argv[])
e("()(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
e("(?:)(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
e("^(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
e("(?Ii)$", "", ONIGERR_INVALID_GROUP_OPTION);
e("(?Ii)|", "", ONIGERR_INVALID_GROUP_OPTION);
x2("(?Ii)$", "", 0, 0);
x2("(?Ii)|", "", 0, 0);
e("(?Ii)|(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION);
x2("a*", "aabcaaa", 0, 2);
x2("(?L)a*", "aabcaaa", 4, 7);
Expand Down

0 comments on commit ec9d8c8

Please sign in to comment.