Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add tests for antipairs
  • Loading branch information
perlpilot committed Aug 20, 2015
1 parent a7f470c commit 971fda7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions S32-hash/antipairs.t
@@ -0,0 +1,25 @@
use v6;
use Test;

# L<S32::Containers/Hash/antipairs>

plan 5;

{
my %h = a => 'b', c => 'd';
isa-ok %h.antipairs, Seq, 'Hash.antipairs returns a Seq';
#?niecza todo 'Cannot use value like Pair as a number'
is-deeply %h.antipairs.sort.list, (b => 'a', d => 'c'), 'simple Hash.antipairs works';
is-deeply %h, { a => 'b', c => 'd' }, 'original remains unchanged';
}

{
# with lists
my %h = a => <b c>, d => 'e';
#?niecza todo 'Cannot use value like Pair as a number'
is-deeply %h.antipairs.sort.list, (<b c> => 'a', e => 'd'),
'Hash.antipairs does not flatten list values';
is-deeply %h, {a => <b c>, d => 'e'}, 'original remains unchanged';
}

# vim: ft=perl6

0 comments on commit 971fda7

Please sign in to comment.