]>
Commit | Line | Data |
---|---|---|
7b7b9e70 UD |
1 | /* Test re_compile_pattern error messages. */ |
2 | ||
3 | #include <stdio.h> | |
4 | #include <string.h> | |
5 | #include <regex.h> | |
6 | ||
7 | int | |
8 | main (void) | |
9 | { | |
10 | struct re_pattern_buffer re; | |
11 | const char *s; | |
12 | int ret = 0; | |
13 | ||
14 | re_set_syntax (RE_SYNTAX_POSIX_EGREP); | |
15 | memset (&re, 0, sizeof (re)); | |
16 | s = re_compile_pattern ("[[.invalid_collating_symbol.]]", 30, &re); | |
17 | if (s == NULL || strcmp (s, "Invalid collation character")) | |
18 | { | |
19 | printf ("re_compile_pattern returned %s\n", s); | |
20 | ret = 1; | |
21 | } | |
22 | s = re_compile_pattern ("[[=invalid_equivalence_class=]]", 31, &re); | |
23 | if (s == NULL || strcmp (s, "Invalid collation character")) | |
24 | { | |
25 | printf ("re_compile_pattern returned %s\n", s); | |
26 | ret = 1; | |
27 | } | |
28 | s = re_compile_pattern ("[[:invalid_character_class:]]", 29, &re); | |
29 | if (s == NULL || strcmp (s, "Invalid character class name")) | |
30 | { | |
31 | printf ("re_compile_pattern returned %s\n", s); | |
32 | ret = 1; | |
33 | } | |
34 | return ret; | |
35 | } |