Skip to content

Commit

Permalink
test for left-nested pairs and .perl method
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Dec 16, 2012
1 parent 70d13c4 commit 0296255
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion S02-types/nested_pairs.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 7;
plan 14;

=begin desc
Expand All @@ -22,4 +22,17 @@ isa_ok($list.value.value, Pair, '$list.value.value is-a Pair');
is($list.value.value.key, 3, 'the list.value.value.key is 3');
is($list.value.value.value, 4, 'the list.value.value.value is 4');

is($list, 1 => 2 => 3 => 4, 'pair operator nests right-associatively');

is($list.perl, '1 => 2 => 3 => 4', 'right-associative nested pairs .perl correctly');

my $r-list = (((1 => 2) => 3) => 4);

is($r-list.key, (1 => 2) => 3, 'the key is a nested pair');
is($r-list.key.key, 1 => 2, 'the key of the key is a nested pair');
is($r-list.value, 4, 'the value is a number');
is($r-list.key.value, 3, 'the value of the key is a number');

is($r-list.perl, '((1 => 2) => 3) => 4', 'key-nested pairs .perl correctly');

# vim: ft=perl6

0 comments on commit 0296255

Please sign in to comment.