Home | History | Annotate | Download | only in testdata
      1 # Tests of \C when Unicode support is available. Note that \C is not supported
      2 # for DFA matching in UTF mode, so this test is not run with -dfa. The output
      3 # of this test is different in 8-, 16-, and 32-bit modes. Some tests may match
      4 # in some widths and not in others.
      5 
      6 /ab\Cde/utf,info
      7 Capturing subpattern count = 0
      8 Contains \C
      9 Options: utf
     10 First code unit = 'a'
     11 Last code unit = 'e'
     12 Subject length lower bound = 0
     13     abXde
     14  0: abXde
     15 
     16 # This should produce an error diagnostic (\C in UTF lookbehind) in 8-bit and
     17 # 16-bit modes, but not in 32-bit mode.
     18 
     19 /(?<=ab\Cde)X/utf
     20 Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion in UTF-8 mode
     21     ab!deXYZ
     22 
     23 # Autopossessification tests
     24 
     25 /\C+\X \X+\C/Bx
     26 ------------------------------------------------------------------
     27         Bra
     28         AllAny+
     29         extuni
     30         extuni+
     31         AllAny
     32         Ket
     33         End
     34 ------------------------------------------------------------------
     35 
     36 /\C+\X \X+\C/Bx,utf
     37 ------------------------------------------------------------------
     38         Bra
     39         Anybyte+
     40         extuni
     41         extuni+
     42         Anybyte
     43         Ket
     44         End
     45 ------------------------------------------------------------------
     46 
     47 /\C\X*T;
     48 {0,6}\v+
F
     50 /utf
     51 \= Expect no match
     52     \x0a
     53 No match
     54 
     55 /\C(\W?)'?{{/utf
     56 \= Expect no match
     57     \\C(\\W?)'?{{
     58 No match
     59 
     60 /X(\C{3})/utf
     61     X\x{1234}
     62  0: X\x{1234}
     63  1: \x{1234}
     64     X\x{11234}Y
     65  0: X\x{f0}\x{91}\x{88}
     66  1: \x{f0}\x{91}\x{88}
     67     X\x{11234}YZ
     68  0: X\x{f0}\x{91}\x{88}
     69  1: \x{f0}\x{91}\x{88}
     70 
     71 /X(\C{4})/utf
     72     X\x{1234}YZ
     73  0: X\x{1234}Y
     74  1: \x{1234}Y
     75     X\x{11234}YZ
     76  0: X\x{11234}
     77  1: \x{11234}
     78     X\x{11234}YZW
     79  0: X\x{11234}
     80  1: \x{11234}
     81 
     82 /X\C*/utf
     83     XYZabcdce
     84  0: XYZabcdce
     85 
     86 /X\C*?/utf
     87     XYZabcde
     88  0: X
     89 
     90 /X\C{3,5}/utf
     91     Xabcdefg
     92  0: Xabcde
     93     X\x{1234}
     94  0: X\x{1234}
     95     X\x{1234}YZ
     96  0: X\x{1234}YZ
     97     X\x{1234}\x{512}
     98  0: X\x{1234}\x{512}
     99     X\x{1234}\x{512}YZ
    100  0: X\x{1234}\x{512}
    101     X\x{11234}Y
    102  0: X\x{11234}Y
    103     X\x{11234}YZ
    104  0: X\x{11234}Y
    105     X\x{11234}\x{512}
    106  0: X\x{11234}\x{d4}
    107     X\x{11234}\x{512}YZ
    108  0: X\x{11234}\x{d4}
    109     X\x{11234}\x{512}\x{11234}Z
    110  0: X\x{11234}\x{d4}
    111 
    112 /X\C{3,5}?/utf
    113     Xabcdefg
    114  0: Xabc
    115     X\x{1234}
    116  0: X\x{1234}
    117     X\x{1234}YZ
    118  0: X\x{1234}
    119     X\x{1234}\x{512}
    120  0: X\x{1234}
    121     X\x{11234}Y
    122  0: X\x{f0}\x{91}\x{88}
    123     X\x{11234}YZ
    124  0: X\x{f0}\x{91}\x{88}
    125     X\x{11234}\x{512}YZ
    126  0: X\x{f0}\x{91}\x{88}
    127     X\x{11234}
    128  0: X\x{f0}\x{91}\x{88}
    129 
    130 /a\Cb/utf
    131     aXb
    132  0: aXb
    133     a\nb
    134  0: a\x{0a}b
    135     a\x{100}b
    136 No match
    137 
    138 /a\C\Cb/utf
    139     a\x{100}b
    140  0: a\x{100}b
    141     a\x{12257}b
    142 No match
    143     a\x{12257}\x{11234}b
    144 No match
    145 
    146 /ab\Cde/utf
    147     abXde
    148  0: abXde
    149 
    150 # This one is here not because it's different to Perl, but because the way
    151 # the captured single code unit is displayed. (In Perl it becomes a character,
    152 # and you can't tell the difference.)
    153 
    154 /X(\C)(.*)/utf
    155     X\x{1234}
    156  0: X\x{1234}
    157  1: \x{e1}
    158  2: \x{88}\x{b4}
    159     X\nabc
    160  0: X\x{0a}abc
    161  1: \x{0a}
    162  2: abc
    163 
    164 # This one is here because Perl gives out a grumbly error message (quite
    165 # correctly, but that messes up comparisons).
    166 
    167 /a\Cb/utf
    168 \= Expect no match in 8-bit mode
    169     a\x{100}b
    170 No match
    171 
    172 # End of testinput22
    173