blob: 55cd0ccc804babeed7f672ded8c090e8f5a7e6d9 [file] [log] [blame]
Elliott Hughes5b808042021-10-01 10:56:10 -07001# 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/^d(e)$/posix
173 acdef\=posix_startend=2:4
174 0: de
175 1: e
176 acde\=posix_startend=2
177 0: de
178 1: e
179\= Expect no match
180 acdef
181No match: POSIX code 17: match failed
182 acdef\=posix_startend=2
183No match: POSIX code 17: match failed
184
185/^a\x{00}b$/posix
186 a\x{00}b\=posix_startend=0:3
187 0: a\x00b
188
189/"A" 00 "B"/hex
190 A\x{00}B\=posix_startend=0:3
191 0: A\x00B
192
193/ABC/use_length
194 ABC
195 0: ABC
196
197/a\b(c/literal,posix
198 a\\b(c
199 0: a\b(c
200
201/a\b(c/literal,posix,dotall
202Failed: POSIX code 16: bad argument at offset 0
203
204/((a)(b)?(c))/posix
205 123ace
206 0: ac
207 1: ac
208 2: a
209 3: <unset>
210 4: c
211 123ace\=posix_startend=2:6
212 0: ac
213 1: ac
214 2: a
215 3: <unset>
216 4: c
217
Elliott Hughes4e19c8e2022-04-15 15:11:02 -0700218//posix
219\= Expect errors
220 \=null_subject
221No match: POSIX code 16: bad argument
222 abc\=null_subject
223No match: POSIX code 16: bad argument
224
Elliott Hughes5b808042021-10-01 10:56:10 -0700225# End of testdata/testinput18