[svn:parrot] r38874 - in trunk: src/pmc t/pmc t/pmc/testlib
Infinoid at svn.parrot.org
Infinoid at svn.parrot.org
Sun May 17 19:47:52 UTC 2009
Author: Infinoid
Date: Sun May 17 19:47:52 2009
New Revision: 38874
URL: https://trac.parrot.org/parrot/changeset/38874
Log:
[pdd13] Spec says PackfileDirectory should handle deletions. Add that vtable and test it.
Modified:
trunk/src/pmc/packfiledirectory.pmc
trunk/t/pmc/packfiledirectory.t
trunk/t/pmc/testlib/packfile_common.pir
Modified: trunk/src/pmc/packfiledirectory.pmc
==============================================================================
--- trunk/src/pmc/packfiledirectory.pmc Sun May 17 19:47:43 2009 (r38873)
+++ trunk/src/pmc/packfiledirectory.pmc Sun May 17 19:47:52 2009 (r38874)
@@ -259,7 +259,7 @@
/*
-=item C<PMC *set_pmc_keyed(PMC *key)>
+=item C<PMC *set_pmc_keyed(PMC *key, PMC *segment)>
Add a segment with the given name to the directory. Dispatches to
set_pmc_keyed_str.
@@ -273,8 +273,25 @@
VTABLE_set_pmc_keyed_str(interp, SELF, s_key, segment);
}
+/*
+
+=item C<PMC *delete_keyed(PMC *key)>
+
+Delete the specified segment from the directory.
+
+=cut
+
+*/
+
+ VTABLE void delete_keyed(PMC *key) {
+ STRING *s_key = VTABLE_get_string(interp, key);
+ VTABLE_delete_keyed(interp,
+ PARROT_PACKFILEDIRECTORY(SELF)->hash, key);
+ }
+
}
+
/*
=back
Modified: trunk/t/pmc/packfiledirectory.t
==============================================================================
--- trunk/t/pmc/packfiledirectory.t Sun May 17 19:47:43 2009 (r38873)
+++ trunk/t/pmc/packfiledirectory.t Sun May 17 19:47:52 2009 (r38874)
@@ -21,7 +21,7 @@
.sub 'main' :main
.include 'test_more.pir'
- plan(21)
+ plan(23)
'test_create'()
'test_typeof'()
@@ -122,7 +122,6 @@
pfdir[$S0] = seg
$I1 = elements pfdir
is($I0, $I1, "Segment with old name was added")
- goto done
# Add segment with new name
add_new:
@@ -133,6 +132,13 @@
inc $I0
is($I0, $I1, "New segment added")
+ # Remove that segment again
+ delete_seg:
+ delete pfdir[$S0]
+ dec $I0
+ $I1 = elements pfdir
+ is($I0, $I1, "segment deleted")
+
done:
.return()
.end
Modified: trunk/t/pmc/testlib/packfile_common.pir
==============================================================================
--- trunk/t/pmc/testlib/packfile_common.pir Sun May 17 19:47:43 2009 (r38873)
+++ trunk/t/pmc/testlib/packfile_common.pir Sun May 17 19:47:52 2009 (r38874)
@@ -19,9 +19,7 @@
.include "interpinfo.pasm"
.local pmc pf, pio
pf = new ['Packfile']
- #$S0 = interpinfo .INTERPINFO_RUNTIME_PREFIX
- #$S0 .= "/runtime/parrot/library/uuid.pbc"
- $S0 = '_filename'()
+ $S0 = '_filename'()
pio = open $S0, 'r'
$S0 = pio.'readall'()
close pio
More information about the parrot-commits
mailing list