2016-02-26 19:26:17 +01:00
|
|
|
# This set of tests exercises the serialization/deserialization and code copy
|
|
|
|
# functions in the library. It does not use UTF or JIT.
|
2015-08-18 12:34:05 +02:00
|
|
|
|
|
|
|
#forbid_utf
|
|
|
|
|
|
|
|
# Compile several patterns, push them onto the stack, and then write them
|
|
|
|
# all to a file.
|
|
|
|
|
|
|
|
#pattern push
|
|
|
|
|
|
|
|
/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
|
|
|
|
(?(DEFINE)
|
|
|
|
(?<NAME_PAT>[a-z]+)
|
|
|
|
(?<ADDRESS_PAT>\d+)
|
|
|
|
)/x
|
|
|
|
/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
|
|
|
|
|
|
|
|
#save testsaved1
|
|
|
|
|
|
|
|
# Do it again for some more patterns.
|
|
|
|
|
|
|
|
/(*MARK:A)(*SKIP:B)(C|X)/mark
|
|
|
|
** Ignored when compiled pattern is stacked with 'push': mark
|
|
|
|
/(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames
|
|
|
|
|
|
|
|
#save testsaved2
|
|
|
|
#pattern -push
|
|
|
|
|
|
|
|
# Reload the patterns, then pop them one by one and check them.
|
|
|
|
|
|
|
|
#load testsaved1
|
|
|
|
#load testsaved2
|
|
|
|
|
|
|
|
#pop info
|
2019-02-06 19:11:36 +01:00
|
|
|
Capture group count = 2
|
2015-08-18 12:34:05 +02:00
|
|
|
Max back reference = 2
|
2019-02-06 19:11:36 +01:00
|
|
|
Named capture groups:
|
2015-08-18 12:34:05 +02:00
|
|
|
n 1
|
|
|
|
n 2
|
|
|
|
Options: dupnames
|
|
|
|
Starting code units: b f
|
|
|
|
Subject length lower bound = 6
|
2017-05-06 18:56:07 +02:00
|
|
|
foofoo
|
2015-08-18 12:34:05 +02:00
|
|
|
0: foofoo
|
|
|
|
1: foo
|
|
|
|
barbar
|
|
|
|
0: barbar
|
|
|
|
1: <unset>
|
|
|
|
2: bar
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2015-08-18 12:34:05 +02:00
|
|
|
#pop mark
|
|
|
|
C
|
|
|
|
0: C
|
|
|
|
1: C
|
|
|
|
MK: A
|
2017-05-06 18:56:07 +02:00
|
|
|
\= Expect no match
|
|
|
|
D
|
2015-08-18 12:34:05 +02:00
|
|
|
No match, mark = A
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2015-08-18 12:34:05 +02:00
|
|
|
#pop
|
2017-05-06 18:56:07 +02:00
|
|
|
AmanaplanacanalPanama
|
2015-08-18 12:34:05 +02:00
|
|
|
0: AmanaplanacanalPanama
|
|
|
|
1: <unset>
|
|
|
|
2: <unset>
|
|
|
|
3: AmanaplanacanalPanama
|
|
|
|
4: A
|
|
|
|
|
|
|
|
#pop info
|
2019-02-06 19:11:36 +01:00
|
|
|
Capture group count = 4
|
|
|
|
Named capture groups:
|
2015-08-18 12:34:05 +02:00
|
|
|
ADDR 2
|
|
|
|
ADDRESS_PAT 4
|
|
|
|
NAME 1
|
|
|
|
NAME_PAT 3
|
|
|
|
Options: extended
|
|
|
|
Subject length lower bound = 3
|
|
|
|
metcalfe 33
|
|
|
|
0: metcalfe 33
|
|
|
|
1: metcalfe
|
|
|
|
2: 33
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2015-08-18 12:34:05 +02:00
|
|
|
# Check for an error when different tables are used.
|
|
|
|
|
|
|
|
/abc/push,tables=1
|
|
|
|
/xyz/push,tables=2
|
|
|
|
#save testsaved1
|
|
|
|
Serialization failed: error -30: patterns do not all use the same character tables
|
|
|
|
|
|
|
|
#pop
|
|
|
|
xyz
|
|
|
|
0: xyz
|
|
|
|
|
|
|
|
#pop
|
|
|
|
abc
|
|
|
|
0: abc
|
|
|
|
|
|
|
|
#pop should give an error
|
|
|
|
** Can't pop off an empty stack
|
|
|
|
pqr
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2016-02-26 19:26:17 +01:00
|
|
|
/abcd/pushcopy
|
|
|
|
abcd
|
|
|
|
0: abcd
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2016-02-26 19:26:17 +01:00
|
|
|
#pop
|
2017-05-06 18:56:07 +02:00
|
|
|
abcd
|
2016-02-26 19:26:17 +01:00
|
|
|
0: abcd
|
|
|
|
|
|
|
|
#pop should give an error
|
|
|
|
** Can't pop off an empty stack
|
|
|
|
|
|
|
|
/abcd/push
|
|
|
|
#popcopy
|
|
|
|
abcd
|
|
|
|
0: abcd
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2016-02-26 19:26:17 +01:00
|
|
|
#pop
|
2017-05-06 18:56:07 +02:00
|
|
|
abcd
|
2016-02-26 19:26:17 +01:00
|
|
|
0: abcd
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2016-02-26 19:26:17 +01:00
|
|
|
/abcd/push
|
|
|
|
#save testsaved1
|
|
|
|
#pop should give an error
|
|
|
|
** Can't pop off an empty stack
|
|
|
|
|
|
|
|
#load testsaved1
|
2017-05-06 18:56:07 +02:00
|
|
|
#popcopy
|
2016-02-26 19:26:17 +01:00
|
|
|
abcd
|
|
|
|
0: abcd
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2016-02-26 19:26:17 +01:00
|
|
|
#pop
|
|
|
|
abcd
|
|
|
|
0: abcd
|
|
|
|
|
|
|
|
#pop should give an error
|
|
|
|
** Can't pop off an empty stack
|
2015-08-18 12:34:05 +02:00
|
|
|
|
2016-11-22 16:37:02 +01:00
|
|
|
/abcd/pushtablescopy
|
|
|
|
abcd
|
|
|
|
0: abcd
|
|
|
|
|
2017-05-06 18:56:07 +02:00
|
|
|
#popcopy
|
2016-11-22 16:37:02 +01:00
|
|
|
abcd
|
|
|
|
0: abcd
|
2017-05-06 18:56:07 +02:00
|
|
|
|
2016-11-22 16:37:02 +01:00
|
|
|
#pop
|
2017-05-06 18:56:07 +02:00
|
|
|
abcd
|
2016-11-22 16:37:02 +01:00
|
|
|
0: abcd
|
|
|
|
|
2017-05-06 18:56:07 +02:00
|
|
|
# Must only specify one of these
|
|
|
|
|
|
|
|
//push,pushcopy
|
|
|
|
** Not allowed together: push pushcopy
|
|
|
|
|
|
|
|
//push,pushtablescopy
|
|
|
|
** Not allowed together: push pushtablescopy
|
|
|
|
|
|
|
|
//pushcopy,pushtablescopy
|
|
|
|
** Not allowed together: pushcopy pushtablescopy
|
|
|
|
|
2015-08-18 12:34:05 +02:00
|
|
|
# End of testinput20
|