Skip to content

Commit

Permalink
Test .subst/.subst-mutate with multi-match args…
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Mar 8, 2018
1 parent 08b6dbe commit af02dd6
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion S05-substitution/subst.t
Expand Up @@ -3,7 +3,7 @@ use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

plan 191;
plan 192;

# L<S05/Substitution/>

Expand Down Expand Up @@ -795,4 +795,37 @@ subtest 'no-matches .subst-mutate: with multi-match opts = empty List' => {
}
}

# RT #130688
subtest '.subst[-mutate] with multi-match args set $/ to a List of matches' => {
plan 2*2*(2+5);
for 1234567, '1234567' -> $type {
for <subst subst-mutate> -> $meth {
subtest "$type.^name().$meth: :g" => {
($ = $type)."$meth"(:g, /../, 'XX');
isa-ok $/, List, '$/ is a List…';
cmp-ok +$/, '==', 3, '…with 3 items…';
is-deeply $/.map({.WHAT}).unique, (Match,).Seq, '…all are Match…';
is-deeply $/.map(~*), <12 34 56>.map(*.Str), '…all have right values';
}
subtest ".$meth: :x" => {
($ = $type)."$meth"(:2x, /../, 'XX');
isa-ok $/, List, '$/ is a List…';
cmp-ok +$/, '==', 2, '…with 2 items…';
is-deeply $/.map({.WHAT}).unique, (Match,).Seq, '…all are Match…';
is-deeply $/.map(~*), <12 34>.map(*.Str), '…all have right values';
}
for <nth st nd rd th> -> $suffix {
subtest ".$meth: :$suffix" => {
($ = $type)."$meth"(|($suffix => 1..3), /../, 'XX');
isa-ok $/, List, '$/ is a List…';
cmp-ok +$/, '==', 3, '…with 3 items…';
is-deeply $/.map({.WHAT}).unique, (Match,).Seq, '…all are Match…';
is-deeply $/.map(~*), <12 34 56>.map(*.Str),
'…all have right values';
}
}
}
}
}

# vim: ft=perl6

0 comments on commit af02dd6

Please sign in to comment.