1# This set of tests is run only with the 8-bit library. It tests the POSIX
2# interface, which is supported only with the 8-bit library. This test should
3# not be run with JIT (which is not available for the POSIX interface).
4
5#forbid_utf
6#pattern posix
7
8# Test some invalid options
9
10/abc/auto_callout
11** Ignored with POSIX interface: auto_callout
12
13/abc/
14   abc\=find_limits
15** Ignored with POSIX interface: find_limits
16 0: abc
17
18/abc/
19  abc\=partial_hard
20** Ignored with POSIX interface: partial_hard
21 0: abc
22
23/a(())bc/parens_nest_limit=1
24** Ignored with POSIX interface: parens_nest_limit
25
26/abc/allow_surrogate_escapes,max_pattern_length=2
27** Ignored with POSIX interface: allow_surrogate_escapes max_pattern_length
28
29# Real tests
30
31/abc/
32    abc
33 0: abc
34
35/^abc|def/
36    abcdef
37 0: abc
38    abcdef\=notbol
39 0: def
40
41/.*((abc)$|(def))/
42    defabc
43 0: defabc
44 1: abc
45 2: abc
46    defabc\=noteol
47 0: def
48 1: def
49 2: <unset>
50 3: def
51
52/the quick brown fox/
53    the quick brown fox
54 0: the quick brown fox
55\= Expect no match
56    The Quick Brown Fox
57No match: POSIX code 17: match failed
58
59/the quick brown fox/i
60    the quick brown fox
61 0: the quick brown fox
62    The Quick Brown Fox
63 0: The Quick Brown Fox
64
65/(*LF)abc.def/
66\= Expect no match
67    abc\ndef
68No match: POSIX code 17: match failed
69
70/(*LF)abc$/
71    abc
72 0: abc
73    abc\n
74 0: abc
75
76/(abc)\2/
77Failed: POSIX code 15: bad back reference at offset 6
78
79/(abc\1)/
80\= Expect no match
81    abc
82No match: POSIX code 17: match failed
83
84/a*(b+)(z)(z)/
85    aaaabbbbzzzz
86 0: aaaabbbbzz
87 1: bbbb
88 2: z
89 3: z
90    aaaabbbbzzzz\=ovector=0
91Matched without capture
92    aaaabbbbzzzz\=ovector=1
93 0: aaaabbbbzz
94    aaaabbbbzzzz\=ovector=2
95 0: aaaabbbbzz
96 1: bbbb
97
98/(*ANY)ab.cd/
99    ab-cd
100 0: ab-cd
101    ab=cd
102 0: ab=cd
103\= Expect no match
104    ab\ncd
105No match: POSIX code 17: match failed
106
107/ab.cd/s
108    ab-cd
109 0: ab-cd
110    ab=cd
111 0: ab=cd
112    ab\ncd
113 0: ab\x0acd
114
115/a(b)c/posix_nosub
116    abc
117Matched with REG_NOSUB
118
119/a(?P<name>b)c/posix_nosub
120    abc
121Matched with REG_NOSUB
122
123/(a)\1/posix_nosub
124    zaay
125Matched with REG_NOSUB
126
127/a?|b?/
128    abc
129 0: a
130\= Expect no match
131    ddd\=notempty
132No match: POSIX code 17: match failed
133
134/\w+A/
135   CDAAAAB
136 0: CDAAAA
137
138/\w+A/ungreedy
139   CDAAAAB
140 0: CDA
141
142/\Biss\B/I,aftertext
143** Ignored with POSIX interface: info
144    Mississippi
145 0: iss
146 0+ issippi
147
148/abc/\
149Failed: POSIX code 9: bad escape sequence at offset 4
150
151"(?(?C)"
152Failed: POSIX code 11: unbalanced () at offset 6
153
154"(?(?C))"
155Failed: POSIX code 3: pattern error at offset 6
156
157/abcd/substitute_extended
158** Ignored with POSIX interface: substitute_extended
159
160/\[A]{1000000}**/expand,regerror_buffsize=31
161Failed: POSIX code 4: ? * + invalid at offset 100000
162** regerror() message truncated
163
164/\[A]{1000000}**/expand,regerror_buffsize=32
165Failed: POSIX code 4: ? * + invalid at offset 1000001
166
167//posix_nosub
168    \=offset=70000
169** Ignored with POSIX interface: offset
170Matched with REG_NOSUB
171
172/(?=(a\K))/
173    a
174Start of matched string is beyond its end - displaying from end to start.
175 0: a
176 1: a
177
178/^d(e)$/posix
179    acdef\=posix_startend=2:4
180 0: de
181 1: e
182    acde\=posix_startend=2
183 0: de
184 1: e
185\= Expect no match
186    acdef
187No match: POSIX code 17: match failed
188    acdef\=posix_startend=2
189No match: POSIX code 17: match failed
190
191/^a\x{00}b$/posix
192    a\x{00}b\=posix_startend=0:3
193 0: a\x00b
194
195/"A" 00 "B"/hex
196    A\x{00}B\=posix_startend=0:3
197 0: A\x00B
198
199/ABC/use_length
200    ABC
201 0: ABC
202
203/a\b(c/literal,posix
204    a\\b(c
205 0: a\b(c
206
207/a\b(c/literal,posix,dotall
208Failed: POSIX code 16: bad argument at offset 0
209
210/((a)(b)?(c))/posix
211    123ace
212 0: ac
213 1: ac
214 2: a
215 3: <unset>
216 4: c
217    123ace\=posix_startend=2:6
218 0: ac
219 1: ac
220 2: a
221 3: <unset>
222 4: c
223
224# End of testdata/testinput18
225