blob: 71f39ae300338bbe7a90be8591e2aae21923b802 [file] [log] [blame]
Janis Danisevskis8b979b22016-08-15 16:09:16 +01001# This set of tests exercises the serialization/deserialization and code copy
2# functions in the library. It does not use UTF or JIT.
Janis Danisevskis53e448c2016-03-31 13:35:25 +01003
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
Elliott Hughes9bc971b2018-07-27 13:23:14 -070034 foofoo
Janis Danisevskis53e448c2016-03-31 13:35:25 +010035 barbar
Elliott Hughes9bc971b2018-07-27 13:23:14 -070036
Janis Danisevskis53e448c2016-03-31 13:35:25 +010037#pop mark
38 C
Elliott Hughes9bc971b2018-07-27 13:23:14 -070039\= Expect no match
40 D
41
Janis Danisevskis53e448c2016-03-31 13:35:25 +010042#pop
Elliott Hughes9bc971b2018-07-27 13:23:14 -070043 AmanaplanacanalPanama
Janis Danisevskis53e448c2016-03-31 13:35:25 +010044
45#pop info
46 metcalfe 33
Elliott Hughes9bc971b2018-07-27 13:23:14 -070047
Janis Danisevskis53e448c2016-03-31 13:35:25 +010048# 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
Elliott Hughes9bc971b2018-07-27 13:23:14 -070062
Janis Danisevskis8b979b22016-08-15 16:09:16 +010063/abcd/pushcopy
64 abcd
Elliott Hughes9bc971b2018-07-27 13:23:14 -070065
Janis Danisevskis8b979b22016-08-15 16:09:16 +010066#pop
Elliott Hughes9bc971b2018-07-27 13:23:14 -070067 abcd
Janis Danisevskis8b979b22016-08-15 16:09:16 +010068
69#pop should give an error
70
71/abcd/push
72#popcopy
73 abcd
Elliott Hughes9bc971b2018-07-27 13:23:14 -070074
Janis Danisevskis8b979b22016-08-15 16:09:16 +010075#pop
Elliott Hughes9bc971b2018-07-27 13:23:14 -070076 abcd
77
Janis Danisevskis8b979b22016-08-15 16:09:16 +010078/abcd/push
79#save testsaved1
80#pop should give an error
81
82#load testsaved1
Elliott Hughes9bc971b2018-07-27 13:23:14 -070083#popcopy
Janis Danisevskis8b979b22016-08-15 16:09:16 +010084 abcd
Elliott Hughes9bc971b2018-07-27 13:23:14 -070085
Janis Danisevskis8b979b22016-08-15 16:09:16 +010086#pop
87 abcd
88
89#pop should give an error
Janis Danisevskis53e448c2016-03-31 13:35:25 +010090
Elliott Hughes9bc971b2018-07-27 13:23:14 -070091/abcd/pushtablescopy
92 abcd
93
94#popcopy
95 abcd
96
97#pop
98 abcd
99
100# Must only specify one of these
101
102//push,pushcopy
103
104//push,pushtablescopy
105
106//pushcopy,pushtablescopy
107
Janis Danisevskis53e448c2016-03-31 13:35:25 +0100108# End of testinput20