Blame src/regression/regex-negated-range.c
|
Szabolcs Nagy |
974c16 |
// negated overlapping ranges in a regex bracket
|
|
Szabolcs Nagy |
974c16 |
// were not handled correctly by tre
|
|
Szabolcs Nagy |
974c16 |
#include <regex.h>
|
|
Szabolcs Nagy |
974c16 |
#include "test.h"
|
|
Szabolcs Nagy |
974c16 |
|
|
Szabolcs Nagy |
974c16 |
int main(void)
|
|
Szabolcs Nagy |
974c16 |
{
|
|
Szabolcs Nagy |
974c16 |
char buf[200];
|
|
Szabolcs Nagy |
974c16 |
regex_t r;
|
|
Szabolcs Nagy |
974c16 |
int n;
|
|
Szabolcs Nagy |
974c16 |
|
|
Szabolcs Nagy |
974c16 |
n = regcomp(&r, "[^aa-z]", 0);
|
|
Szabolcs Nagy |
974c16 |
if (n) {
|
|
Szabolcs Nagy |
974c16 |
regerror(n, &r, buf, sizeof buf);
|
|
Szabolcs Nagy |
974c16 |
t_error("regcomp returned %d (%s)\n", n, buf);
|
|
Szabolcs Nagy |
974c16 |
}
|
|
Szabolcs Nagy |
974c16 |
|
|
Szabolcs Nagy |
974c16 |
n = regexec(&r, "k", 0, 0, REG_NOSUB);
|
|
Szabolcs Nagy |
86f39d |
if (n != REG_NOMATCH) {
|
|
Szabolcs Nagy |
86f39d |
regerror(n, &r, buf, sizeof buf);
|
|
Szabolcs Nagy |
86f39d |
t_error("regexec(/[^aa-z]/ ~ \"k\") returned %d (%s), wanted REG_NOMATCH\n",
|
|
Szabolcs Nagy |
86f39d |
n, buf);
|
|
Szabolcs Nagy |
86f39d |
}
|
|
Szabolcs Nagy |
974c16 |
|
|
Szabolcs Nagy |
974c16 |
regfree(&r);
|
|
Szabolcs Nagy |
974c16 |
|
|
Szabolcs Nagy |
974c16 |
return t_status;
|
|
Szabolcs Nagy |
974c16 |
}
|