Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
antipairs and inversions
  • Loading branch information
TimToady committed Feb 28, 2015
1 parent c349a13 commit 9c69eb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 4 additions & 5 deletions S02-types/pair.t
Expand Up @@ -316,9 +316,9 @@ Note, "non-chaining binary" was later renamed to "structural infix".
}

{
is (a => 3).exchange.key, 3, 'Pair.exchange.key';
isa_ok (a => 3).exchange.key, Int, 'Pair.exchange.key type';
is (a => 3).exchange.value, 'a', 'Pair.exchange.value';
is (a => 3).antipair.key, 3, 'Pair.antipair.key';
isa_ok (a => 3).antipair.key, Int, 'Pair.antipair.key type';
is (a => 3).antipair.value, 'a', 'Pair.antipair.value';
}

{
Expand All @@ -327,12 +327,11 @@ Note, "non-chaining binary" was later renamed to "structural infix".
is (a => 3).invert[0].value, 'a', 'Pair.invert.value';
}

#?rakudo skip 'Pair.invert value splitting NYI'
{
is (a => [3,4]).invert.elems, 2, 'Pair.invert splits positional values';
is (a => [3,4]).invert».key, '3 4', 'Pair.invert splits positional values and preserves order';
isa_ok (a => [3,4]).invert[0].key, Int, 'Pair.invert.key type';
is (a => [3,4]).invert».key, 'a a', 'Pair.invert splits positional values and dups keys';
is (a => [3,4]).invert».value, 'a a', 'Pair.invert splits positional values and dups keys';
}

# RT #123215
Expand Down
1 change: 0 additions & 1 deletion S32-hash/invert.t
Expand Up @@ -16,7 +16,6 @@ plan 5;
{
# with lists
my %h = a => <b c>, d => 'e';
#?rakudo todo 'nom regression'
#?niecza todo 'Cannot use value like Pair as a number'
is_deeply %h.invert.sort, (b => 'a', c => 'a', e => 'd'),
'Hash.invert flattens list values';
Expand Down

0 comments on commit 9c69eb1

Please sign in to comment.