Home | History | Annotate | Download | only in testdata
      1 # This is a specialized test for checking, when PCRE2 is compiled with the
      2 # EBCDIC option but in an ASCII environment, that newline, white space, and \c
      3 # functionality is working. It catches cases where explicit values such as 0x0a
      4 # have been used instead of names like CHAR_LF. Needless to say, it is not a
      5 # genuine EBCDIC test! In patterns, alphabetic characters that follow a
      6 # backslash must be in EBCDIC code. In data, NL, NEL, LF, ESC, and DEL must be
      7 # in EBCDIC, but can of course be specified as escapes.
      8 
      9 # Test default newline and variations
     10 
     11 /^A/m
     12     ABC
     13  0: A
     14     12\x15ABC
     15  0: A
     16 
     17 /^A/m,newline=any
     18     12\x15ABC
     19  0: A
     20     12\x0dABC
     21  0: A
     22     12\x0d\x15ABC
     23  0: A
     24     12\x25ABC
     25  0: A
     26 
     27 /^A/m,newline=anycrlf
     28     12\x15ABC
     29  0: A
     30     12\x0dABC
     31  0: A
     32     12\x0d\x15ABC
     33  0: A
     34     ** Fail
     35 No match
     36     12\x25ABC
     37 No match
     38 
     39 # Test \h
     40 
     41 /^A\/
     42     A B
     43  0: A\x20
     44     A\x41B 
     45  0: AA
     46 
     47 # Test \H
     48 
     49 /^A\/
     50     AB
     51  0: AB
     52     A\x42B 
     53  0: AB
     54     ** Fail
     55 No match
     56     A B
     57 No match
     58     A\x41B 
     59 No match
     60 
     61 # Test \R
     62 
     63 /^A\/
     64     A\x15B
     65  0: A\x15
     66     A\x0dB
     67  0: A\x0d
     68     A\x25B
     69  0: A\x25
     70     A\x0bB
     71  0: A\x0b
     72     A\x0cB
     73  0: A\x0c
     74     ** Fail
     75 No match
     76     A B
     77 No match
     78 
     79 # Test \v
     80 
     81 /^A\/
     82     A\x15B
     83  0: A\x15
     84     A\x0dB
     85  0: A\x0d
     86     A\x25B
     87  0: A\x25
     88     A\x0bB
     89  0: A\x0b
     90     A\x0cB
     91  0: A\x0c
     92     ** Fail
     93 No match
     94     A B
     95 No match
     96 
     97 # Test \V
     98 
     99 /^A\/
    100     A B
    101  0: A\x20
    102     ** Fail
    103 No match
    104     A\x15B
    105 No match
    106     A\x0dB
    107 No match
    108     A\x25B
    109 No match
    110     A\x0bB
    111 No match
    112     A\x0cB
    113 No match
    114     
    115 # For repeated items, use an atomic group so that the output is the same
    116 # for DFA matching (otherwise it may show multiple matches).
    117 
    118 # Test \h+
    119 
    120 /^A(?>\+)/
    121     A B
    122  0: A\x20
    123 
    124 # Test \H+
    125 
    126 /^A(?>\+)/
    127     AB
    128  0: AB
    129     ** Fail
    130 No match
    131     A B
    132 No match
    133 
    134 # Test \R+
    135 
    136 /^A(?>\+)/
    137     A\x15B
    138  0: A\x15
    139     A\x0dB
    140  0: A\x0d
    141     A\x25B
    142  0: A\x25
    143     A\x0bB
    144  0: A\x0b
    145     A\x0cB
    146  0: A\x0c
    147     ** Fail
    148 No match
    149     A B
    150 No match
    151 
    152 # Test \v+
    153 
    154 /^A(?>\+)/
    155     A\x15B
    156  0: A\x15
    157     A\x0dB
    158  0: A\x0d
    159     A\x25B
    160  0: A\x25
    161     A\x0bB
    162  0: A\x0b
    163     A\x0cB
    164  0: A\x0c
    165     ** Fail
    166 No match
    167     A B
    168 No match
    169 
    170 # Test \V+
    171 
    172 /^A(?>\+)/
    173     A B
    174  0: A\x20B
    175     ** Fail
    176 No match
    177     A\x15B
    178 No match
    179     A\x0dB
    180 No match
    181     A\x25B
    182 No match
    183     A\x0bB
    184 No match
    185     A\x0cB
    186 No match
    187     
    188 # Test \c functionality 
    189     
    190 /\@\A\b\C\d\E\f\G\h\I\J\K\l\m\N\O\p\q\r\S\T\u\V\W\X\y\Z/
    191     \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f
    192  0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a
    193 
    194 /\[\\\]\^\_/
    195     \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f
    196  0: \x1b\x1c\x1d\x1e\x1f
    197     
    198 /\?/
    199     A\xffB
    200  0: \xff
    201 
    202 /\&/
    203 Failed: error 168 at offset 2: \c\x20must\x20be\x20followed\x20by\x20a\x20letter\x20or\x20one\x20of\x20[\]^_\x3f
    204 
    205 # End
    206