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