• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4#forbid_utf
5
6# Compile several patterns, push them onto the stack, and then write them
7# all to a file.
8
9#pattern push
10
11/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
12  (?(DEFINE)
13  (?<NAME_PAT>[a-z]+)
14  (?<ADDRESS_PAT>\d+)
15  )/x
16/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
17
18#save testsaved1
19
20# Do it again for some more patterns.
21
22/(*MARK:A)(*SKIP:B)(C|X)/mark
23/(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames
24
25#save testsaved2
26#pattern -push
27
28# Reload the patterns, then pop them one by one and check them.
29
30#load testsaved1
31#load testsaved2
32
33#pop info
34    foofoo
35    barbar
36
37#pop mark
38    C
39\= Expect no match
40    D
41
42#pop
43    AmanaplanacanalPanama
44
45#pop info
46    metcalfe 33
47
48# Check for an error when different tables are used.
49
50/abc/push,tables=1
51/xyz/push,tables=2
52#save testsaved1
53
54#pop
55    xyz
56
57#pop
58    abc
59
60#pop should give an error
61    pqr
62
63/abcd/pushcopy
64    abcd
65
66#pop
67    abcd
68
69#pop should give an error
70
71/abcd/push
72#popcopy
73    abcd
74
75#pop
76    abcd
77
78/abcd/push
79#save testsaved1
80#pop should give an error
81
82#load testsaved1
83#popcopy
84    abcd
85
86#pop
87    abcd
88
89#pop should give an error
90
91# End of testinput20
92