[svn:parrot] r38051 - branches/packfile_revamp/t/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Apr 11 02:24:42 UTC 2009


Author: bacek
Date: Sat Apr 11 02:24:42 2009
New Revision: 38051
URL: https://trac.parrot.org/parrot/changeset/38051

Log:
Add test for FixupTable/FixupEntry pack/unpack

Modified:
   branches/packfile_revamp/t/pmc/packfile.t

Modified: branches/packfile_revamp/t/pmc/packfile.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfile.t	Sat Apr 11 02:24:24 2009	(r38050)
+++ branches/packfile_revamp/t/pmc/packfile.t	Sat Apr 11 02:24:42 2009	(r38051)
@@ -22,7 +22,7 @@
 .sub main :main
 .include 'test_more.pir'
 
-    plan(17)
+    plan(21)
     'test_new'()
     'test_get_string'()
     'test_set_string'()
@@ -177,6 +177,11 @@
     #$P0 = new 'PackfileConstantTable'
     #$P0[0] = 42.0
     $P0 = new 'PackfileFixupTable'
+    $P1 = new 'PackfileFixupEntry'
+    $P1 = 42
+    $P1.'set_type'(1)
+    $P1 = "The fixup"
+    $P0[0] = $P1
     pfdir["FIXUP_t/pmc/packfile.t"] = $P0
 
     $P1 = new 'PackfileRawSegment'
@@ -184,13 +189,23 @@
 
     # Pack it
     $S0 = pf
-
     ok(1, "PackFile packed")
 
     pf = new 'Packfile'
     pf = $S0
     ok(1, "PackFile unpacked after pack")
 
+    # Check that FixupTable contains our Entry.
+    $P0 = _get_fixup_table(pf)
+    $I1 = elements $P0
+    is($I1, 1, "FixupTable contains one element")
+    $P1 = $P0[0]
+    isa_ok($P1, "PackfileFixupEntry")
+    $I0 = $P1
+    is($I0, 42, "FixupEntry offset preserved")
+    $S0 = $P1
+    is($S0, "The fixup", "FixupEntry name preserved")
+
     #$P1 = open "/tmp/1.pbc", "w"
     #$P1.'puts'($S0)
     #close $P1


More information about the parrot-commits mailing list