github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
3.7 KiB

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