From b92c4a84ee5bca905c4e86e9fdeb39e862c9bb6d Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Tue, 28 Feb 2012 14:00:49 +0100 Subject: [PATCH] rewrite parents.t to not use infix: with Mu as argument --- S12-introspection/parents.t | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/S12-introspection/parents.t b/S12-introspection/parents.t index 13c6381df6..07a547eed0 100644 --- a/S12-introspection/parents.t +++ b/S12-introspection/parents.t @@ -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)';