Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 40 lines (29 sloc) 0.839 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
use v6;
use Test;
plan 10;

#L<S05/New metacharacters/"As with the disjunctions | and ||">

{
    my $str = 'x' x 7;

    ok $str ~~ m/x||xx||xxxx/;
    is ~$/, 'x', 'first || alternative matches';
    ok $str ~~ m/xx||x||xxxx/;
    is ~$/, 'xx', 'first || alternative matches';
}

{
    my $str = 'x' x 3;
    ok $str ~~ m/xxxx||xx||x/;
    is ~$/, 'xx', 'second alternative || matches if first fails';
}

#L<S05/"Variable (non-)interpolation"/"An interpolated array:">

{
    my $str = 'x' x 7;
    my @list = <x xx xxxx>;

    ok $str ~~ m/ ||@list /;
    #?niecza todo 'sequential alternation NYI'
    is ~$/, 'x', 'first ||@list alternative matches';

    @list = <xx x xxxx>;

    ok $str ~~ m/ ||@list /;
    #?niecza todo 'sequential alternation NYI'
    is ~$/, 'xx', 'first ||@list alternative matches';
}

# vim: ft=perl6
Something went wrong with that request. Please try again.