Blame src/regression/regex-bracket-icase.c
|
Szabolcs Nagy |
05b75a |
// [^aBcC] with REG_ICASE should match d,D but not a,A,b,B,c,C according to
|
|
Szabolcs Nagy |
05b75a |
// http://austingroupbugs.net/view.php?id=872
|
|
Szabolcs Nagy |
05b75a |
#include <regex.h>
|
|
Szabolcs Nagy |
05b75a |
#include <limits.h>
|
|
Szabolcs Nagy |
05b75a |
#include <stdio.h>
|
|
Szabolcs Nagy |
05b75a |
#include "test.h"
|
|
Szabolcs Nagy |
05b75a |
|
|
Szabolcs Nagy |
05b75a |
int main(void)
|
|
Szabolcs Nagy |
05b75a |
{
|
|
Szabolcs Nagy |
05b75a |
char buf[100];
|
|
Szabolcs Nagy |
05b75a |
char *pat;
|
|
Szabolcs Nagy |
05b75a |
regex_t re;
|
|
Szabolcs Nagy |
05b75a |
int n, i;
|
|
Szabolcs Nagy |
05b75a |
struct {
|
|
Szabolcs Nagy |
05b75a |
char *s;
|
|
Szabolcs Nagy |
05b75a |
int n;
|
|
Szabolcs Nagy |
05b75a |
} t[] = {
|
|
Szabolcs Nagy |
05b75a |
{"a", REG_NOMATCH},
|
|
Szabolcs Nagy |
05b75a |
{"A", REG_NOMATCH},
|
|
Szabolcs Nagy |
05b75a |
{"b", REG_NOMATCH},
|
|
Szabolcs Nagy |
05b75a |
{"B", REG_NOMATCH},
|
|
Szabolcs Nagy |
05b75a |
{"c", REG_NOMATCH},
|
|
Szabolcs Nagy |
05b75a |
{"C", REG_NOMATCH},
|
|
Szabolcs Nagy |
05b75a |
{"d", 0},
|
|
Szabolcs Nagy |
05b75a |
{"D", 0},
|
|
Szabolcs Nagy |
05b75a |
{0,0}
|
|
Szabolcs Nagy |
05b75a |
};
|
|
Szabolcs Nagy |
05b75a |
|
|
Szabolcs Nagy |
05b75a |
pat = "[^aBcC]";
|
|
Szabolcs Nagy |
05b75a |
n = regcomp(&re, pat, REG_ICASE);
|
|
Szabolcs Nagy |
05b75a |
if (n) {
|
|
Szabolcs Nagy |
05b75a |
regerror(n, &re, buf, sizeof buf);
|
|
Szabolcs Nagy |
05b75a |
t_error("regcomp(\"%s\") failed: %d (%s)\n", pat, n, buf);
|
|
Szabolcs Nagy |
05b75a |
}
|
|
Szabolcs Nagy |
05b75a |
|
|
Szabolcs Nagy |
05b75a |
for (i = 0; t[i].s; i++) {
|
|
Szabolcs Nagy |
05b75a |
n = regexec(&re, t[i].s, 0, 0, 0);
|
|
Szabolcs Nagy |
05b75a |
if (n != t[i].n) {
|
|
Szabolcs Nagy |
05b75a |
regerror(n, &re, buf, sizeof buf);
|
|
Szabolcs Nagy |
05b75a |
t_error("regexec(/%s/, \"%s\") returned %d (%s), wanted %d\n",
|
|
Szabolcs Nagy |
05b75a |
pat, t[i].s, n, buf, t[i].n);
|
|
Szabolcs Nagy |
05b75a |
}
|
|
Szabolcs Nagy |
05b75a |
}
|
|
Szabolcs Nagy |
05b75a |
|
|
Szabolcs Nagy |
05b75a |
return t_status;
|
|
Szabolcs Nagy |
05b75a |
}
|