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.

396 lines
4.1 KiB

  1. # This file tests the auxiliary pattern conversion features of the PCRE2
  2. # library, in non-UTF mode.
  3. #forbid_utf
  4. #newline_default lf any anycrlf
  5. # -------- Tests of glob conversion --------
  6. # Set the glob separator explicitly so that different OS defaults are not a
  7. # problem. Then test various errors.
  8. #pattern convert=glob,convert_glob_escape=\,convert_glob_separator=/
  9. /abc/posix
  10. # Separator must be / \ or .
  11. /a*b/convert_glob_separator=%
  12. # Can't have separator in a class
  13. "[ab/cd]"
  14. "[,-/]"
  15. /[ab/
  16. # Length check
  17. /abc/convert_length=11
  18. /abc/convert_length=12
  19. # Now some actual tests
  20. /a?b[]xy]*c/
  21. azb]1234c
  22. # Tests from the gitwildmatch list, with some additions
  23. /foo/
  24. foo
  25. /= Expect no match
  26. bar
  27. //
  28. \
  29. /???/
  30. foo
  31. \= Expect no match
  32. foobar
  33. /*/
  34. foo
  35. \
  36. /f*/
  37. foo
  38. f
  39. /*f/
  40. oof
  41. \= Expect no match
  42. foo
  43. /*foo*/
  44. foo
  45. food
  46. aprilfool
  47. /*ob*a*r*/
  48. foobar
  49. /*ab/
  50. aaaaaaabababab
  51. /foo\*/
  52. foo*
  53. /foo\*bar/
  54. \= Expect no match
  55. foobar
  56. /f\\oo/
  57. f\\oo
  58. /*[al]?/
  59. ball
  60. /[ten]/
  61. \= Expect no match
  62. ten
  63. /t[a-g]n/
  64. ten
  65. /a[]]b/
  66. a]b
  67. /a[]a-]b/
  68. /a[]-]b/
  69. a-b
  70. a]b
  71. \= Expect no match
  72. aab
  73. /a[]a-z]b/
  74. aab
  75. /]/
  76. ]
  77. /t[!a-g]n/
  78. ton
  79. \= Expect no match
  80. ten
  81. '[[:alpha:]][[:digit:]][[:upper:]]'
  82. a1B
  83. '[[:digit:][:upper:][:space:]]'
  84. A
  85. 1
  86. \ \=
  87. \= Expect no match
  88. a
  89. .
  90. '[a-c[:digit:]x-z]'
  91. 5
  92. b
  93. y
  94. \= Expect no match
  95. q
  96. # End of gitwildmatch tests
  97. /*.j?g/
  98. pic01.jpg
  99. .jpg
  100. pic02.jxg
  101. \= Expect no match
  102. pic03.j/g
  103. /A[+-0]B/
  104. A+B
  105. A.B
  106. A0B
  107. \= Expect no match
  108. A/B
  109. /*x?z/
  110. abc.xyz
  111. \= Expect no match
  112. .xyz
  113. /?x?z/
  114. axyz
  115. \= Expect no match
  116. .xyz
  117. "[,-0]x?z"
  118. ,xyz
  119. \= Expect no match
  120. /xyz
  121. .xyz
  122. ".x*"
  123. .xabc
  124. /a[--0]z/
  125. a-z
  126. a.z
  127. a0z
  128. \= Expect no match
  129. a/z
  130. a1z
  131. /<[a-c-d]>/
  132. <a>
  133. <b>
  134. <c>
  135. <d>
  136. <->
  137. /a[[:digit:].]z/
  138. a1z
  139. a.z
  140. \= Expect no match
  141. a:z
  142. /a[[:digit].]z/
  143. a[.]z
  144. a:.]z
  145. ad.]z
  146. /<[[:a[:digit:]b]>/
  147. <[>
  148. <:>
  149. <a>
  150. <9>
  151. <b>
  152. \= Expect no match
  153. <d>
  154. /a*b/convert_glob_separator=\
  155. /a*b/convert_glob_separator=.
  156. /a*b/convert_glob_separator=/
  157. # Non control character checking
  158. /A\B\\C\D/
  159. /\\{}\?\*+\[\]()|.^$/
  160. /*a*\/*b*/
  161. /?a?\/?b?/
  162. /[a\\b\c][]][-][\]\-]/
  163. /[^a\\b\c][!]][!-][^\]\-]/
  164. /[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]/
  165. "[/-/]"
  166. /[-----]/
  167. /[------]/
  168. /[!------]/
  169. /[[:alpha:]-a]/
  170. /[[:alpha:]][[:punct:]][[:ascii:]]/
  171. /[a-[:alpha:]]/
  172. /[[:alpha:/
  173. /[[:alpha:]/
  174. /[[:alphaa:]]/
  175. /[[:xdigi:]]/
  176. /[[:xdigit::]]/
  177. /****/
  178. /**\/abc/
  179. abc
  180. x/abc
  181. xabc
  182. /abc\/**/
  183. /abc\/**\/abc/
  184. /**\/*a*b*g*n*t/
  185. abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt
  186. /**\/*a*\/**/
  187. xx/xx/xx/xax/xx/xb
  188. /**\/*a*/
  189. xx/xx/xx/xax
  190. xx/xx/xx/xax/xx
  191. /**\/*a*\/**\/*b*/
  192. xx/xx/xx/xax/xx/xb
  193. xx/xx/xx/xax/xx/x
  194. "**a"convert=glob
  195. a
  196. c/b/a
  197. c/b/aaa
  198. "a**/b"convert=glob
  199. a/b
  200. ab
  201. "a/**b"convert=glob
  202. a/b
  203. ab
  204. #pattern convert=glob:glob_no_starstar
  205. /***/
  206. /**a**/
  207. #pattern convert=unset
  208. #pattern convert=glob:glob_no_wild_separator
  209. /*/
  210. /*a*/
  211. /**a**/
  212. /a*b/
  213. /*a*b*/
  214. /??a??/
  215. #pattern convert=unset
  216. #pattern convert=glob,convert_glob_escape=0
  217. /a\b\cd/
  218. /**\/a/
  219. /a`*b/convert_glob_escape=`
  220. /a`*b/convert_glob_escape=0
  221. /a`*b/convert_glob_escape=x
  222. # -------- Tests of extended POSIX conversion --------
  223. #pattern convert=unset:posix_extended
  224. /<[[:a[:digit:]b]>/
  225. <[>
  226. <:>
  227. <a>
  228. <9>
  229. <b>
  230. \= Expect no match
  231. <d>
  232. /a+\1b\\c|d[ab\c]/
  233. /<[]bc]>/
  234. <]>
  235. <b>
  236. <c>
  237. /<[^]bc]>/
  238. <.>
  239. \= Expect no match
  240. <]>
  241. <b>
  242. /(a)\1b/
  243. a1b
  244. \= Expect no match
  245. aab
  246. /(ab)c)d]/
  247. Xabc)d]Y
  248. /a***b/
  249. # -------- Tests of basic POSIX conversion --------
  250. #pattern convert=unset:posix_basic
  251. /a*b+c\+[def](ab)\(cd\)/
  252. /\(a\)\1b/
  253. aab
  254. \= Expect no match
  255. a1b
  256. /how.to how\.to/
  257. how\nto how.to
  258. \= Expect no match
  259. how\x{0}to how.to
  260. /^how to \^how to/
  261. /^*abc/
  262. /*abc/
  263. X*abcY
  264. /**abc/
  265. XabcY
  266. X*abcY
  267. X**abcY
  268. /*ab\(*cd\)/
  269. /^b\(c^d\)\(^e^f\)/
  270. /a***b/
  271. # End of testinput24