string test alignment fix by Mahesh Bodapati
[libc-test.git] / src / regression / regex-ere-backref.c
blob196b25ccf82a0a31e6d656fe5a7ee64e7ef50bea
1 // commit 7c8c86f6308c7e0816b9638465a5917b12159e8f 2015-03-20
2 // backref is not valid in ere
3 #include <regex.h>
4 #include "test.h"
6 int main(void)
8 char buf[200];
9 char pat[] = "(a)\\1";
10 regex_t r;
11 int n;
13 n = regcomp(&r, pat, REG_EXTENDED);
14 if (n) {
15 regerror(n, &r, buf, sizeof buf);
16 t_error("regcomp(%s) returned %d (%s) wanted 0\n", pat, n, buf);
19 n = regexec(&r, "aa", 0, 0, 0);
20 if (n != REG_NOMATCH) {
21 regerror(n, &r, buf, sizeof buf);
22 t_error("regexec(/%s/ ~ \"aa\") returned %d (%s), wanted REG_NOMATCH\n",
23 pat, n, buf);
26 n = regexec(&r, "a1", 0, 0, 0);
27 if (n) {
28 regerror(n, &r, buf, sizeof buf);
29 t_error("regexec(/%s/ ~ \"a1\") returned %d (%s), wanted 0\n",
30 pat, n, buf);
33 return t_status;