[svn:parrot] r40998 - trunk/t/pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat Sep 5 13:34:38 UTC 2009
Author: whiteknight
Date: Sat Sep 5 13:34:37 2009
New Revision: 40998
URL: https://trac.parrot.org/parrot/changeset/40998
Log:
[t] convert two more Perl tests to PIR, and create a new test for the global namespace
Modified:
trunk/t/pmc/namespace-old.t
trunk/t/pmc/namespace.t
Modified: trunk/t/pmc/namespace-old.t
==============================================================================
--- trunk/t/pmc/namespace-old.t Sat Sep 5 13:26:19 2009 (r40997)
+++ trunk/t/pmc/namespace-old.t Sat Sep 5 13:34:37 2009 (r40998)
@@ -6,7 +6,7 @@
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 63;
+use Parrot::Test tests => 61;
use Parrot::Config;
=head1 NAME
@@ -23,45 +23,8 @@
=cut
-pir_output_is( <<'CODE', <<'OUTPUT', "get_namespace Foo::bar" );
-.sub 'main' :main
- $P0 = get_global ["Foo"], "bar"
- print "ok\n"
- $P1 = $P0."get_namespace"()
- print $P1
- print "\n"
-.end
-
-.namespace ["Foo"]
-.sub 'bar'
-.end
-CODE
-ok
-Foo
-OUTPUT
-
-pir_output_is( <<'CODE', <<'OUTPUT', "get_global Foo::bar ns" );
-.sub 'main' :main
- $P1 = get_global ["Foo"], "bar"
- print "ok\n"
- $P1()
-.end
-
-.namespace ["Foo"]
-.sub 'bar'
- print "bar\n"
-.end
-CODE
-ok
-bar
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUTPUT', "get_global Foo::bar hash" );
.sub 'main' :main
- $P0 = get_global "Foo"
- $P1 = $P0["bar"]
- print "ok\n"
- $P1()
.end
.namespace ["Foo"]
Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t Sat Sep 5 13:26:19 2009 (r40997)
+++ trunk/t/pmc/namespace.t Sat Sep 5 13:34:37 2009 (r40998)
@@ -18,11 +18,13 @@
.sub main :main
.include 'test_more.pir'
- plan(5)
+ plan(8)
create_namespace_pmc()
verify_namespace_type()
get_global_opcode()
+ get_sub_from_namespace_hash()
+ get_namespace_from_sub()
.end
# L<PDD21/Namespace PMC API/=head4 Untyped Interface>
@@ -69,6 +71,26 @@
_end:
.end
+.sub 'get_sub_from_namespace_hash'
+ $P0 = get_global "Foo"
+ $P1 = $P0["bar"]
+ $S0 = $P1()
+ is($S0, "Foo", "Get the Sub from the NameSpace as a Hash")
+.end
+
+.sub 'get_namespace_from_sub'
+ $P0 = get_global ["Foo"], "bar"
+ $P1 = $P0."get_namespace"()
+ $S0 = $P1
+ is($S0, "Foo", "Get the namespace from a Sub in the NameSpace")
+
+ $P0 = get_global "bar"
+ $P1 = $P0."get_namespace"()
+ $S0 = $P1
+ is($S0, "parrot", "Get the root namespace from a sub in the root namespace")
+.end
+
+
##### TEST NAMESPACES AND FUNCTIONS #####
# These functions and namespaces are used for the tests above
More information about the parrot-commits
mailing list