Skip to content

Commit

Permalink
Test List of Pairs/Hash .Set coercer
Browse files Browse the repository at this point in the history
- Ensure the .values of Pairs get interpreted as weights
  • Loading branch information
zoffixznet committed Sep 22, 2017
1 parent 0b67426 commit 1e20619
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion S02-types/set.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 215;
plan 217;

sub showset($s) { $s.keys.sort.join(' ') }

Expand Down Expand Up @@ -70,6 +70,14 @@ sub showset($s) { $s.keys.sort.join(' ') }

isa-ok {a => 2, b => 4, c => 0}.Set, Set, '{a => 2, b => 4, c => 0}.Set makes a Set';
is showset({a => 2, b => 4, c => 0}.Set), 'a b', '{a => 2, b => 4, c => 0}.Set makes the set a b';

is-deeply (:a, :!b, :3c, :0d, :e<meow>, :f(''), 'g').Set,
set('a', 'c', 'e', 'g'),
'.Set on List of Pairs treats Pair.value as weight';

is-deeply {:a, :!b, :3c, :0d, :e<meow>, :f('')}.Set,
set('a', 'c', 'e'),
'.Set on Hash of Pairs treats Pair.value as weight';
}

{
Expand Down

0 comments on commit 1e20619

Please sign in to comment.