Skip to content

Commit

Permalink
Standalone test for upstream laurikari#101.
Browse files Browse the repository at this point in the history
  • Loading branch information
dag-erling committed Jul 25, 2024
1 parent ca34130 commit f4422bc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ TESTS = test-str-source retest
if TRE_MULTIBYTE
TESTS += wretest
endif TRE_MULTIBYTE

check_PROGRAMS += bore
bore_SOURCES = bore.c
bore_CPPFLAGS = $(retest_CPPFLAGS)
bore_LDADD = $(retest_LDADD)
25 changes: 25 additions & 0 deletions tests/bore.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <regex.h>

int main(void)
{
regex_t reg;

if (regcomp(&reg, "^|$", REG_EXTENDED | REG_NOSUB) != 0)
return 2;
/* should not match becuase BOL and EOL are disabled */
if (regexec(&reg, "", 0, NULL, REG_NOTBOL | REG_NOTEOL) != REG_NOMATCH)
return 1;
/* should match because BOL is disabled but EOL is not */
if (regexec(&reg, "", 0, NULL, REG_NOTBOL) != 0)
return 1;
/* should match because EOL is disabled but BOL is not */
if (regexec(&reg, "", 0, NULL, REG_NOTEOL) != 0)
return 1;
regfree(&reg);
return 0;
}

0 comments on commit f4422bc

Please sign in to comment.