Skip to content

Commit ff5bd05

Browse files
committed
RT #118985 test lexical regexes in classes
1 parent bea8d27 commit ff5bd05

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

S05-metasyntax/regex.t

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 26;
4+
plan 29;
55

66
eval_dies_ok('qr/foo/', 'qr// is gone');
77

@@ -88,4 +88,35 @@ ok ';' ~~ /\;/, 'escaped ";" in m// works';
8888
#?niecza todo 'invalid syntax'
8989
eval_lives_ok '/<[..b]>/', '/<[..b]>/ lives';
9090

91+
# RT #118985
92+
{
93+
class HasSub {
94+
sub parse(Str $input) {
95+
my regex anything { . }
96+
42 if $input ~~ /<anything>/
97+
}
98+
method call-parse-sub(Str $input) {
99+
parse($input);
100+
}
101+
}
102+
103+
class HasSubMethod {
104+
submethod parse(Str $input) {
105+
my regex anything { . }
106+
43 if $input ~~ /<anything>/
107+
}
108+
}
109+
110+
class HasMethod {
111+
method parse(Str $input) {
112+
my regex anything { . }
113+
44 if $input ~~ /<anything>/
114+
}
115+
}
116+
117+
is HasSub.call-parse-sub('foo'), 42, 'can have a lexical regex in a sub in a class';
118+
is HasSubMethod.parse('foo'), 43, 'can have a lexical regex in a submethod in a class';
119+
is HasMethod.parse('foo'), 44, 'can have a lexical regex in a method in a class';
120+
}
121+
91122
# vim: ft=perl6

0 commit comments

Comments
 (0)