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.

161 lines
2.4 KiB

  1. # This set of tests exercises the serialization/deserialization and code copy
  2. # functions in the library. It does not use UTF or JIT.
  3. #forbid_utf
  4. # Compile several patterns, push them onto the stack, and then write them
  5. # all to a file.
  6. #pattern push
  7. /(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
  8. (?(DEFINE)
  9. (?<NAME_PAT>[a-z]+)
  10. (?<ADDRESS_PAT>\d+)
  11. )/x
  12. /^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
  13. #save testsaved1
  14. # Do it again for some more patterns.
  15. /(*MARK:A)(*SKIP:B)(C|X)/mark
  16. ** Ignored when compiled pattern is stacked with 'push': mark
  17. /(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames
  18. #save testsaved2
  19. #pattern -push
  20. # Reload the patterns, then pop them one by one and check them.
  21. #load testsaved1
  22. #load testsaved2
  23. #pop info
  24. Capture group count = 2
  25. Max back reference = 2
  26. Named capture groups:
  27. n 1
  28. n 2
  29. Options: dupnames
  30. Starting code units: b f
  31. Subject length lower bound = 6
  32. foofoo
  33. 0: foofoo
  34. 1: foo
  35. barbar
  36. 0: barbar
  37. 1: <unset>
  38. 2: bar
  39. #pop mark
  40. C
  41. 0: C
  42. 1: C
  43. MK: A
  44. \= Expect no match
  45. D
  46. No match, mark = A
  47. #pop
  48. AmanaplanacanalPanama
  49. 0: AmanaplanacanalPanama
  50. 1: <unset>
  51. 2: <unset>
  52. 3: AmanaplanacanalPanama
  53. 4: A
  54. #pop info
  55. Capture group count = 4
  56. Named capture groups:
  57. ADDR 2
  58. ADDRESS_PAT 4
  59. NAME 1
  60. NAME_PAT 3
  61. Options: extended
  62. Subject length lower bound = 3
  63. metcalfe 33
  64. 0: metcalfe 33
  65. 1: metcalfe
  66. 2: 33
  67. # Check for an error when different tables are used.
  68. /abc/push,tables=1
  69. /xyz/push,tables=2
  70. #save testsaved1
  71. Serialization failed: error -30: patterns do not all use the same character tables
  72. #pop
  73. xyz
  74. 0: xyz
  75. #pop
  76. abc
  77. 0: abc
  78. #pop should give an error
  79. ** Can't pop off an empty stack
  80. pqr
  81. /abcd/pushcopy
  82. abcd
  83. 0: abcd
  84. #pop
  85. abcd
  86. 0: abcd
  87. #pop should give an error
  88. ** Can't pop off an empty stack
  89. /abcd/push
  90. #popcopy
  91. abcd
  92. 0: abcd
  93. #pop
  94. abcd
  95. 0: abcd
  96. /abcd/push
  97. #save testsaved1
  98. #pop should give an error
  99. ** Can't pop off an empty stack
  100. #load testsaved1
  101. #popcopy
  102. abcd
  103. 0: abcd
  104. #pop
  105. abcd
  106. 0: abcd
  107. #pop should give an error
  108. ** Can't pop off an empty stack
  109. /abcd/pushtablescopy
  110. abcd
  111. 0: abcd
  112. #popcopy
  113. abcd
  114. 0: abcd
  115. #pop
  116. abcd
  117. 0: abcd
  118. # Must only specify one of these
  119. //push,pushcopy
  120. ** Not allowed together: push pushcopy
  121. //push,pushtablescopy
  122. ** Not allowed together: push pushtablescopy
  123. //pushcopy,pushtablescopy
  124. ** Not allowed together: pushcopy pushtablescopy
  125. # End of testinput20