Author: particle
Date: Mon Feb 5 13:43:19 2007
New Revision: 16897
Modified:
trunk/src/pmc/namespace.pmc
trunk/t/pmc/namespace.t
Log:
[PDD21]: correct NameSpace PMC to implement 'hash' role
~ fix typo
~ add two NameSpace PMC tests
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc (original)
+++ trunk/src/pmc/namespace.pmc Mon Feb 5 13:43:19 2007
@@ -48,11 +48,11 @@
#define FPA_is_ns_ext PObj_private0_FLAG
-pmclass NameSpace extends Hash need_ext no_ro {
+pmclass NameSpace extends Hash does hash need_ext no_ro {
/*
-=item C<voit init()>
+=item C<void init()>
Initialize a C<NameSpace> PMC by calling C<Hash.init> and clearing
other fields.
Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t (original)
+++ trunk/t/pmc/namespace.t Mon Feb 5 13:43:19 2007
@@ -6,12 +6,12 @@
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 50;
+use Parrot::Test tests => 52;
use Parrot::Config;
=head1 NAME
-t/pmc/namespace.t - Namespaces
+t/pmc/namespace.t - test the NameSpace PMC as described in PDD21.
=head1 SYNOPSIS
@@ -19,10 +19,35 @@
=head1 DESCRIPTION
-Tests the namespace manipulation.
+Test the NameSpace PMC as described in PDD21.
=cut
+
+pir_output_is( <<'CODE', <<'OUT', 'new' );
+.sub 'test' :main
+ new $P0, .NameSpace
+ say 'ok 1 - $P0 = new .NameSpace'
+.end
+CODE
+ok 1 - $P0 = new .NameSpace
+OUT
+
+
+pir_output_is( <<'CODE', <<'OUT', 'NameSpace does "hash"' );
+.sub 'test' :main
+ new $P0, .NameSpace
+ $I0 = does $P0, 'hash'
+ if $I0 goto ok_1
+ print 'not '
+ ok_1:
+ say 'ok 1 - NameSpace does "hash"'
+.end
+CODE
+ok 1 - NameSpace does "hash"
+OUT
+
+
pir_output_is( <<'CODE', <<'OUTPUT', "find_global bar" );
.sub 'main' :main
$P0 = find_global "bar"