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 May 24, 2024
1 parent 07e66d0 commit 3f1d3a2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects

SUBDIRS = agrep

check_PROGRAMS = retest randtest test-str-source
check_PROGRAMS = retest randtest test-str-source bore
EXTRA_PROGRAMS = bench
LDADD = $(LTLIBINTL)

Expand Down Expand Up @@ -68,3 +68,7 @@ TESTS = test-str-source retest
if TRE_MULTIBYTE
TESTS += wretest
endif TRE_MULTIBYTE

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

#include <regex.h>

int main(void)
{
regmatch_t match[1];
regex_t reg;

if (regcomp(&reg, "^|$", REG_EXTENDED) != 0 ||
regexec(&reg, "", 1, match, REG_NOTBOL) != 0 ||
match[0].rm_so != 0 || match[0].rm_eo != 0)
return 1;
regfree(&reg);
return 0;
}

0 comments on commit 3f1d3a2

Please sign in to comment.