[svn:parrot] r40994 - trunk/t/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sat Sep 5 13:06:50 UTC 2009


Author: whiteknight
Date: Sat Sep  5 13:06:47 2009
New Revision: 40994
URL: https://trac.parrot.org/parrot/changeset/40994

Log:
[t] move some more NameSpace tests from Perl to PIR

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 12:54:33 2009	(r40993)
+++ trunk/t/pmc/namespace-old.t	Sat Sep  5 13:06:47 2009	(r40994)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 67;
+use Parrot::Test tests => 64;
 use Parrot::Config;
 
 =head1 NAME
@@ -23,52 +23,6 @@
 
 =cut
 
-# L<PDD21/Namespace PMC API/=head4 Untyped Interface>
-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
-
-# L<PDD21//>
-pir_output_is( <<'CODE', <<'OUTPUT', "get_global bar" );
-.sub 'main' :main
-    $P0 = get_global "bar"
-    print "ok\n"
-    $P0()
-.end
-
-.sub 'bar'
-    print "bar\n"
-.end
-CODE
-ok
-bar
-OUTPUT
-
-pir_output_is( <<'CODE', <<'OUTPUT', "verify NameSpace type" );
-.sub 'main' :main
-    $P0 = get_global "Foo"
-    typeof $S0, $P0
-    print $S0
-    print "\n"
-.end
-
-.namespace ["Foo"]
-.sub 'bar'
-    noop
-.end
-CODE
-NameSpace
-OUTPUT
-
 pir_output_is( <<'CODE', <<'OUTPUT', "get_global Foo::bar" );
 .sub 'main' :main
     $P0 = get_global ["Foo"], "bar"

Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t	Sat Sep  5 12:54:33 2009	(r40993)
+++ trunk/t/pmc/namespace.t	Sat Sep  5 13:06:47 2009	(r40994)
@@ -18,9 +18,12 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(1)
+    plan(4)
 
     create_namespace_pmc()
+    namespace_does_hash()
+    get_global_function()
+    verify_namespace_type()
 .end
 
 .sub 'create_namespace_pmc'
@@ -28,8 +31,42 @@
     $P0 = new ['NameSpace']
     pop_eh
     ok(1, "Create new Namespace PMC")
-    goto _end
+    goto end
   eh:
     ok(0, "Could not create Namespace PMC")
+  end:
+.end
+
+# L<PDD21/Namespace PMC API/=head4 Untyped Interface>
+.sub 'namespace_does_hash'
+    new $P0, ['NameSpace']
+    $I0 = does $P0, 'hash'
+    ok($I0, "Namespace does hash")
+.end
+
+# L<PDD21//>
+.sub 'get_global_function'
+    push_eh eh
+    $P0 = get_global "get_global_function_bar"
+    $I0 = $P0()
+    ok($I0, "Can get_global a .sub")
+    goto _end
+  eh:
+    ok(0, "Cannot get_global a .sub")
   _end:
-.end
\ No newline at end of file
+.end
+
+.sub 'get_global_function_bar'
+    .return(1)
+.end
+
+.sub 'verify_namespace_type'
+    $P0 = get_global "verify_namespace_Foo"
+    typeof $S0, $P0
+    is($S0, "NameSpace", "A NameSpace is a NameSpace")
+.end
+
+.namespace ["verify_namespace_Foo"]
+.sub 'bar'
+    noop
+.end


More information about the parrot-commits mailing list