Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (27 sloc) 0.745 kb
002a3d4 [spec] added test for sequential alternations (||) in regexes
moritz authored
1 use v6;
2 use Test;
3a1ce4c [spec] tests for interpolated sequential alternations ( ||@list )
moritz authored
3 plan 10;
002a3d4 [spec] added test for sequential alternations (||) in regexes
moritz authored
4
5 #L<S05/New metacharacters/"As with the disjunctions | and ||">
6
7 {
8 my $str = 'x' x 7;
9
10 ok $str ~~ m/x||xx||xxxx/;
11 is ~$/, 'x', 'first || alternative matches';
12 ok $str ~~ m/xx||x||xxxx/;
13 is ~$/, 'xx', 'first || alternative matches';
14 }
15
16 {
17 my $str = 'x' x 3;
18 ok $str ~~ m/xxxx||xx||x/;
19 is ~$/, 'xx', 'second alternative || matches if first fails';
20 }
3a1ce4c [spec] tests for interpolated sequential alternations ( ||@list )
moritz authored
21
22 #L<S05/"Variable (non-)interpolation"/"An interpolated array:">
23
24 {
25 my $str = 'x' x 7;
26 my @list = <x xx xxxx>;
27
28 ok $str ~~ m/ ||@list /;
29 is ~$/, 'x', 'first ||@list alternative matches';
30
31 @list = <xx x xxxx>;
32
33 ok $str ~~ m/ ||@list /;
34 is ~$/, 'xx', 'first ||@list alternative matches';
35 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
36
37 # vim: ft=perl6
Something went wrong with that request. Please try again.