Skip to content

Commit

Permalink
Add tests for RT #130366
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Olof Hendig committed Jul 18, 2017
1 parent 9b51341 commit bf26816
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion S02-types/baghash.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 290;
plan 291;

# L<S02/Mutable types/QuantHash of UInt>

Expand Down Expand Up @@ -666,4 +666,15 @@ subtest 'BagHash autovivification of non-existent keys' => {
}
}

# RT #130366
subtest 'elements with weight zero are removed' => {
plan 3;
my $b = <a b b c d e f>.BagHash; $_-- for $b.values;
is-deeply $b, ("b"=>1).BagHash, 'weight decrement';
$b = <a b b c d e f>.BagHash; .value-- for $b.pairs;
is-deeply $b, ("b"=>1).BagHash, 'Pair value decrement';
$b = <a b b c d e f>.BagHash; $_= 0 for $b.values;
is $b, ().BagHash, 'weight set to zero';
}

# vim: ft=perl6
13 changes: 12 additions & 1 deletion S02-types/mixhash.t
Expand Up @@ -3,7 +3,7 @@ use lib <t/spec/packages>;
use Test::Util;
use Test;

plan 260;
plan 261;

# L<S02/Mutable types/QuantHash of UInt>

Expand Down Expand Up @@ -603,4 +603,15 @@ subtest 'MixHash autovivification of non-existent keys' => {
'final value 0 disappears in MixHash (2)';
}

# RT #130366
subtest 'elements with weight zero are removed' => {
plan 3;
my $b = <a b b c d e f>.MixHash; $_-- for $b.values;
is-deeply $b, ("b"=>1).MixHash, 'weight decrement';
$b = <a b b c d e f>.MixHash; .value-- for $b.pairs;
is-deeply $b, ("b"=>1).MixHash, 'Pair value decrement';
$b = <a b b c d e f>.MixHash; $_= 0 for $b.values;
is $b, ().MixHash, 'weight set to zero';
}

# vim: ft=perl6

0 comments on commit bf26816

Please sign in to comment.