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

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sat Sep 5 13:22:47 UTC 2009


Author: whiteknight
Date: Sat Sep  5 13:22:43 2009
New Revision: 40995
URL: https://trac.parrot.org/parrot/changeset/40995

Log:
[t] move over other tests, and refactor them o put like tests together

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:06:47 2009	(r40994)
+++ trunk/t/pmc/namespace-old.t	Sat Sep  5 13:22:43 2009	(r40995)
@@ -23,22 +23,6 @@
 
 =cut
 
-pir_output_is( <<'CODE', <<'OUTPUT', "get_global Foo::bar" );
-.sub 'main' :main
-    $P0 = get_global ["Foo"], "bar"
-    print "ok\n"
-    $P0()
-.end
-
-.namespace ["Foo"]
-.sub 'bar'
-    print "bar\n"
-.end
-CODE
-ok
-bar
-OUTPUT
-
 pir_output_is( <<'CODE', <<'OUTPUT', "get_namespace Foo::bar" );
 .sub 'main' :main
     $P0 = get_global ["Foo"], "bar"

Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t	Sat Sep  5 13:06:47 2009	(r40994)
+++ trunk/t/pmc/namespace.t	Sat Sep  5 13:22:43 2009	(r40995)
@@ -18,55 +18,67 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(4)
+    plan(5)
 
     create_namespace_pmc()
-    namespace_does_hash()
-    get_global_function()
     verify_namespace_type()
+    get_global_opcode()
 .end
 
+# L<PDD21/Namespace PMC API/=head4 Untyped Interface>
 .sub 'create_namespace_pmc'
-    push_eh eh
+    push_eh eh1
     $P0 = new ['NameSpace']
     pop_eh
     ok(1, "Create new Namespace PMC")
-    goto end
-  eh:
+    $I0 = does $P0, 'hash'
+    ok($I0, "Namespace does hash")
+    goto _end
+  eh1:
     ok(0, "Could not create Namespace PMC")
-  end:
+    ok(0, "NameSpace does not does hash")
+  _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")
+.sub 'verify_namespace_type'
+    $P0 = get_global "Foo"
+    typeof $S0, $P0
+    is($S0, "NameSpace", "A NameSpace is a NameSpace")
 .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:
+.sub 'get_global_opcode'
+    push_eh eh1
+    $P0 = get_global "bar"
+    $S0 = $P0()
+    pop_eh
+    is($S0, "", "Can get_global a .sub")
+    goto test2
+  eh1:
     ok(0, "Cannot get_global a .sub")
+
+  test2:
+    push_eh eh2
+    $P0 = get_global ["Foo"], "bar"
+    $S0 = $P0()
+    pop_eh
+    is($S0, "Foo", "Get Sub from NameSpace")
+    goto _end
+  eh2:
+    ok(0, "Cannot get Sub from NameSpace")
   _end:
 .end
 
-.sub 'get_global_function_bar'
-    .return(1)
-.end
+##### TEST NAMESPACES AND FUNCTIONS #####
+# These functions and namespaces are used for the tests above
 
-.sub 'verify_namespace_type'
-    $P0 = get_global "verify_namespace_Foo"
-    typeof $S0, $P0
-    is($S0, "NameSpace", "A NameSpace is a NameSpace")
+.namespace []
+
+.sub 'bar'
+    .return("")
 .end
 
-.namespace ["verify_namespace_Foo"]
+.namespace ["Foo"]
 .sub 'bar'
-    noop
+    .return("Foo")
 .end


More information about the parrot-commits mailing list