Skip to content

Commit 564768b

Browse files
committed
Various meta-chars tests.
1 parent 8eb6810 commit 564768b

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

t/p5regex/01-p5regex.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use NQPP5QRegex;
55
my @files := [
66
'rx_basic',
77
'rx_quantifiers',
8-
'rx_charclass'
8+
'rx_charclass',
9+
'rx_metachars'
910
];
1011

1112
my %expansions;

t/p5regex/rx_metachars

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Metacharacter tests
2+
. a y dot (.)
3+
. \n y dot (.)
4+
. '' n dot (.)
5+
a\s+f abcdef n whitespace (\s)
6+
ab\s+cdef ab cdef y whitespace (\s)
7+
a\S+f abcdef y not whitespace (\S)
8+
a\S+f ab cdef n not whitespace (\S)
9+
^ abc abcdef y start and end of string (^)
10+
^ abc abc\ndef y start and end of string (^)
11+
^ abc def\nabc n start and end of string (^)
12+
def \n ^ abc def\nabc n start and end of string (^)
13+
def $ abcdef y start and end of string ($)
14+
def $ abc\ndef y start and end of string ($)
15+
def $ def\nabc n start and end of string ($)
16+
def $ \n abc def\nabc n start and end of string (^)
17+
abc \n $ abc\n y end of string ($)
18+
abc $ abc\n y end of string with newline ($)
19+
c \n d abc\ndef y logical newline (\n)
20+
c \n d abc\rdef y logical newline matches \r
21+
c \n+ d abc\n\ndef y logical newline quantified
22+
a\n+f abcdef n logical newline (\n)
23+
c \n d abc\n\rdef n logical newline matches \n\r
24+
c \n d abc\r\ndef y logical newline matches \r\n
25+
b \n c abc\ndef n logical newline (\n)
26+
\N a y not logical newline (\N)
27+
a \N c abc y not logical newline (\N)
28+
\N '' n not logical newline (\N)
29+
c \N d abc\ndef n not logical newline (\N)
30+
c \N d abc\rdef n not logical newline (\N)
31+
c \N+ d abc\n\ndef n not logical newline (\N)
32+
a\N+f abcdef y not logical newline (\N)
33+
c \N d abc\n\rdef n not logical newline (\N)
34+
c \N d abc\r\ndef n not logical newline (\N)
35+
b \N \n abc\ndef y not logical newline (\N)
36+
[a-d] | [b-e] c y alternation (|)
37+
[a-d] | [d-e] c y alternation (|)
38+
[a-b] | [b-e] c y alternation (|)
39+
[a-b] | [d-e] c n alternation (|)
40+
[a-d]+ | [b-e]+ bcd y alternation (|)

0 commit comments

Comments
 (0)