diff --git a/tests/Makefile.am b/tests/Makefile.am index d73acac..de8a385 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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) diff --git a/tests/bore.c b/tests/bore.c new file mode 100644 index 0000000..8829009 --- /dev/null +++ b/tests/bore.c @@ -0,0 +1,25 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +int main(void) +{ + regex_t reg; + + if (regcomp(®, "^|$", REG_EXTENDED | REG_NOSUB) != 0) + return 2; + /* should not match becuase BOL and EOL are disabled */ + if (regexec(®, "", 0, NULL, REG_NOTBOL | REG_NOTEOL) != REG_NOMATCH) + return 1; + /* should match because BOL is disabled but EOL is not */ + if (regexec(®, "", 0, NULL, REG_NOTBOL) != 0) + return 1; + /* should match because EOL is disabled but BOL is not */ + if (regexec(®, "", 0, NULL, REG_NOTEOL) != 0) + return 1; + regfree(®); + return 0; +} +