X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fregression%2Fregex-backref-0.c;h=289be3bb9e472afe683a71f6dda5a22cabc6fa1f;hb=2c671f66e28ac079ae1148f5135c9a52129cc807;hp=c5f20b5615d9e0eb35a8bf8497cdbe464d133bbb;hpb=7b44045598c0ef3afdd4b3209b6c02c6a9822f28;p=libc-test diff --git a/src/regression/regex-backref-0.c b/src/regression/regex-backref-0.c index c5f20b5..289be3b 100644 --- a/src/regression/regex-backref-0.c +++ b/src/regression/regex-backref-0.c @@ -1,4 +1,5 @@ -// \0 is not a valid backref +// \0 is not a valid backref, it is undefined by the standard +// we treat such cases as literal char #include #include "test.h" @@ -10,10 +11,15 @@ int main(void) int n; n = regcomp(&r, pat, 0); - // standard allows REG_BADPAT for all pattern errors - if (n != REG_ESUBREG && n != REG_BADPAT) { + if (n) { regerror(n, &r, buf, sizeof buf); - t_error("regcomp(%s) returned %d (%s) wanted REG_ESUBREG\n", pat, n, buf); + t_error("regcomp(%s) returned %d (%s) wanted 0\n", pat, n, buf); + } + n = regexec(&r, "a0", 0, 0, 0); + if (n) { + regerror(n, &r, buf, sizeof buf); + t_error("regexec(/%s/ ~ \"a0\") returned %d (%s), wanted 0\n", + pat, n, buf); } return t_status;