Author: chromatic
Date: Sun Sep 30 21:36:00 2007
New Revision: 21704

Modified:
   branches/pdd15oo/runtime/parrot/library/Data/Dumper/Base.pir
   branches/pdd15oo/t/pdd15oo/dumper.t

Log:
[Data::Dumper] Made the final test pass.

All objects get dumped specially by Data::Dumper; they're PMCs first and
foremost, not array- or other primitive-like data structures.


Modified: branches/pdd15oo/runtime/parrot/library/Data/Dumper/Base.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Data/Dumper/Base.pir        
(original)
+++ branches/pdd15oo/runtime/parrot/library/Data/Dumper/Base.pir        Sun Sep 
30 21:36:00 2007
@@ -212,9 +212,14 @@
 
     #is _dump undef?
     func = "genericUndef"
-    $I0 = defined _dump
+    $I0  = defined _dump
     unless $I0 goto DUMP
 
+    func = "pmcDefault"
+    $I0  = isa _dump, "Object"
+    if $I0 goto DUMP
+
+  TEST_GENERIC:
     # does a generic helper method exist?
     func = "genericHash"
     $I0 = does _dump, "hash"

Modified: branches/pdd15oo/t/pdd15oo/dumper.t
==============================================================================
--- branches/pdd15oo/t/pdd15oo/dumper.t (original)
+++ branches/pdd15oo/t/pdd15oo/dumper.t Sun Sep 30 21:36:00 2007
@@ -945,26 +945,22 @@
 
     print " (size:"
     print value
-    print ") => {\n"
-  iter_loop:
-     unless iter goto iter_end
-     value = shift iter
-     print "\t"
-     print value
-     print ", "
-     goto iter_loop
-  iter_end:
-    print "\n}"
+    print ") => [\n"
+
+    .local string values
+    values = join ",\n    ", self
+    print "    "
+    print values
+    print "\n]"
 .end
 .namespace
 .include 'library/dumper.pir'
 
 CODE
-"VAR1" => 'bar' (size:2) [
+"VAR1" => PMC 'bar'  (size:2) => [
     1,
     2
 ]
-}
 OUTPUT
 
 # pir_output_is(<<'CODE', <<'OUTPUT', "dumping IntegerArray PMC");

Reply via email to