Skip to content

Commit c498bcc

Browse files
committed
Test repeated(:as, :with) in Any-iterable-methods
1 parent 34ad043 commit c498bcc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

S32-list/repeated.t

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 34;
5+
plan 38;
66

77
=begin description
88
@@ -131,6 +131,21 @@ This test tests the C<repeated> builtin.
131131
"final result with [eqv] and objects in place";
132132
} #4
133133

134+
# :with and :as
135+
{
136+
my @array = ({:a<1>}, {:B<1>}, {:A<1>}, {:b<1>});
137+
my $as = &lc;
138+
my $with = &[eqv];
139+
is-deeply @array.repeated(:$as, :$with).List, ({:A<1>}, {:b<1>}),
140+
"method form of repeated with :as and :with and objects works";
141+
is-deeply repeated(@array, :$as, :$with).List, ({:A<1>}, {:b<1>}),
142+
"subroutine form of repeated with :as and :with and objects works";
143+
is-deeply @array .= repeated(:$as, :$with), [{:A<1>}, {:b<1>}],
144+
"inplace form of repeated with :as and :with and objects works";
145+
is-deeply @array, [{:A<1>}, {:b<1>}],
146+
"final result with :as and :with and objects in place";
147+
} #4
148+
134149
{
135150
my %a;
136151
%a<foo> = <a b c b c>;

0 commit comments

Comments
 (0)