Skip to content

Commit

Permalink
Test for SetHash assignment
Browse files Browse the repository at this point in the history
Support for rakudo/rakudo#3013
  • Loading branch information
vrurg committed Jun 21, 2019
1 parent b24d940 commit 12298da
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion S03-operators/assign.t
Expand Up @@ -6,7 +6,7 @@ use Test;
# V
# L<S03/Changes to Perl 5 operators/list assignment operator now parses on the right>

plan 301;
plan 307;


# tests various assignment styles
Expand Down Expand Up @@ -975,4 +975,21 @@ sub l () { 1, 2 };
throws-like my $b; $b %= 2, Exception, '%= with :U target throws';
}

# GH #1203
{
my %s := SetHash.new;

%s = SetHash.new: <a aa ab abc b bb bcd>;

ok %s.WHAT ~~ SetHash, "SetHash type is preserved";
is %s.elems, 7, "number of elements is correct";
is-deeply %s.keys.sort, <a aa ab abc b bb bcd>, "values are correct";

%s (-)= %s.grep: *.key.chars > 2;

ok %s.WHAT ~~ SetHash, "it is still SetHash type";
is %s.elems, 5, "number of elements as expected";
is-deeply %s.keys.sort, <a aa ab b bb>, "all long elements are excluded";
}

# vim: ft=perl6

0 comments on commit 12298da

Please sign in to comment.