1 // negated overlapping ranges in a regex bracket
2 // were not handled correctly by tre
3 #include <regex.h>
4 #include "test.h"
5
main(void)6 int main(void)
7 {
8 char buf[200];
9 regex_t r;
10 int n;
11
12 n = regcomp(&r, "[^aa-z]", 0);
13 if (n) {
14 regerror(n, &r, buf, sizeof buf);
15 t_error("regcomp returned %d (%s)\n", n, buf);
16 }
17
18 n = regexec(&r, "k", 0, 0, 0);
19 if (n != REG_NOMATCH) {
20 regerror(n, &r, buf, sizeof buf);
21 t_error("regexec(/[^aa-z]/ ~ \"k\") returned %d (%s), wanted REG_NOMATCH\n",
22 n, buf);
23 }
24
25 return t_status;
26 }
27