setlocale C.UTF-8 in regex test that depends on UTF-8
[libc-test] / src / regression / regex-escaped-high-byte.c
1 // commit 39dfd58417ef642307d90306e1c7e50aaec5a35c 2015-03-20
2 // backslash followed by high byte should be parsed as a normal sequence
3 #include <locale.h>
4 #include <regex.h>
5 #include "test.h"
6
7 int main(void)
8 {
9         char buf[200];
10         regex_t r;
11         int n;
12
13         setlocale(LC_CTYPE, "C.UTF-8");
14
15         // illegal sequence (not U+00FC)
16         n = regcomp(&r, "\\\xfc", 0);
17         if (n != REG_BADPAT) {
18                 regerror(n, &r, buf, sizeof buf);
19                 t_error("regcomp(\\\\\\xfc) returned %d (%s) wanted REG_BADPAT\n", n, buf);
20         }
21
22         return t_status;
23 }