From 7b44045598c0ef3afdd4b3209b6c02c6a9822f28 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sun, 22 Mar 2015 00:24:15 +0000 Subject: [PATCH] regex backref \0 regression test --- src/regression/regex-backref-0.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/regression/regex-backref-0.c diff --git a/src/regression/regex-backref-0.c b/src/regression/regex-backref-0.c new file mode 100644 index 0000000..c5f20b5 --- /dev/null +++ b/src/regression/regex-backref-0.c @@ -0,0 +1,20 @@ +// \0 is not a valid backref +#include +#include "test.h" + +int main(void) +{ + char buf[200]; + char pat[] = "a\\0"; + regex_t r; + int n; + + n = regcomp(&r, pat, 0); + // standard allows REG_BADPAT for all pattern errors + if (n != REG_ESUBREG && n != REG_BADPAT) { + regerror(n, &r, buf, sizeof buf); + t_error("regcomp(%s) returned %d (%s) wanted REG_ESUBREG\n", pat, n, buf); + } + + return t_status; +} -- 2.11.4.GIT