Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more List.tree tests
  • Loading branch information
moritz committed Feb 6, 2012
1 parent cf643f6 commit f684933
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions S02-lists/tree.t
@@ -1,13 +1,20 @@
use v6;
use Test;
plan 3;
plan 8;

is (1, 2, (3, 4)).tree.elems, 3, 'basic sanity (1)';
is (1, 2, (3, 4)).tree.join('|'), '1|2|3 4', 'basic sanity (2)';
ok List.tree === List, '.tree on a type object';
is (1, 2, (3, 4)).tree(1).join('|'), '1|2|3 4', '.tree(1)';
is (1, (2, (3, 4))).tree(1).[1].flat.elems, 3,
'.tree(1) really only goes one level deep';

is (1, (2, (3, 4))).tree(2).[1].flat.elems, 2,
'.tree(2) goes two levels deep';
is ~((1, 2), (3, 4)).tree(*.join('|')), '1|2 3|4',
'WhateverCode form, depth 1';

#?rakudo skip 'Advanced forms of .tree'
{
is ~((1, 2), (3, 4)).tree(*.join('|')), '1|2 3|4',
'WhateverCode form, depth 1';
}

#?rakudo skip 'multiple Whatever-closures'
is (1, ((2, 3), (4, 5))).tree(*.join('|'), *.join('+')).join('-'),
'1-2|3+4|5', '.tree with multiple Whatever-closures';

0 comments on commit f684933

Please sign in to comment.