Skip to content

Commit 169937b

Browse files
committed
Cover .grep(Regex) on Race/Hyper seqs
Rakudo fix: rakudo/rakudo@5e462e125d
1 parent 6607795 commit 169937b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

S32-list/grep.t

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ built-in grep tests
99
1010
=end pod
1111

12-
plan 44;
12+
plan 45;
1313

1414
my @list = (1 .. 10);
1515

@@ -167,4 +167,17 @@ my @list = (1 .. 10);
167167
);
168168
}
169169

170+
# https://irclog.perlgeek.de/perl6/2018-03-04#i_15882545
171+
subtest '.grep(Regex) on hyper/race Seq do not crash' => {
172+
plan 4;
173+
is-deeply "a\nb\nc\nbo\n".lines.race.grep(/b/).List, <b bo>, 'race basic';
174+
is-deeply "a\nb\nc\nbo\n".lines.hyper.grep(/b/).List, <b bo>, 'hyper basic';
175+
176+
my @has := (^10_000).eager;
177+
my @wanted := @has.grep(*.contains: '2').List;
178+
my $w = '2';
179+
is-deeply @has.race.grep( /$w/).List, @wanted, 'race, with shared var';
180+
is-deeply @has.hyper.grep(/$w/).List, @wanted, 'hyper, with shared var';
181+
}
182+
170183
# vim: ft=perl6

0 commit comments

Comments
 (0)