Skip to content

Commit

Permalink
rewrite parents.t to not use infix:<eqv> with Mu as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Feb 28, 2012
1 parent 8c63c26 commit b92c4a8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions S12-introspection/parents.t
Expand Up @@ -86,14 +86,19 @@ ok @parents[1].WHAT =:= C, 'second parent is C';
is +@parents, 2, 'with :tree, D has two immediate parents (on proto)';
ok @parents[0] ~~ Array, ':tree gives back nested arrays for each parent (on proto)';
ok @parents[1] ~~ Array, ':tree gives back nested arrays for each parent (on proto)';
ok @parents eqv [[B, [A, [Any, [Mu]]]], [C, [A, [Any, [Mu]]]]],
':tree gives back the expected data structure (on proto)';
sub walk(Mu $a) {
$a ~~ Positional
?? '(' ~ $a.map(&walk).join(', ') ~ ')'
!! $a.gist;
}
is walk(@parents), walk( [[B, [A, [Any, [Mu]]]], [C, [A, [Any, [Mu]]]]]),
':tree gives back the expected data structure (on proto)';

@parents = D.new.^parents(:tree);
is +@parents, 2, 'with :tree, D has two immediate parents (on instance)';
ok @parents[0] ~~ Array, ':tree gives back nested arrays for each parent (on instance)';
ok @parents[1] ~~ Array, ':tree gives back nested arrays for each parent (on instance)';
ok @parents eqv [[B, [A, [Any, [Mu]]]], [C, [A, [Any, [Mu]]]]],
is walk(@parents), walk([[B, [A, [Any, [Mu]]]], [C, [A, [Any, [Mu]]]]]),
':tree gives back the expected data structure (on instance)';


Expand Down

0 comments on commit b92c4a8

Please sign in to comment.