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

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Mon Sep 7 17:38:28 UTC 2009


Author: whiteknight
Date: Mon Sep  7 17:38:27 2009
New Revision: 41119
URL: https://trac.parrot.org/parrot/changeset/41119

Log:
[t] convert another NameSpace test 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	Mon Sep  7 17:13:15 2009	(r41118)
+++ trunk/t/pmc/namespace-old.t	Mon Sep  7 17:38:27 2009	(r41119)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 45;
+use Parrot::Test tests => 44;
 use Parrot::Config;
 
 =head1 NAME
@@ -24,20 +24,6 @@
 =cut
 
 # How do we convert this to PIR?
-pir_output_is( <<'CODE', <<'OUTPUT', 'get namespace of :anon .sub' );
-.namespace ['lib']
-.sub main :main :anon
-    $P0 = get_namespace
-    $P0 = $P0.'get_name'()
-    $S0 = join "::", $P0
-    say $S0
-    end
-.end
-CODE
-parrot::lib
-OUTPUT
-
-# How do we convert this to PIR?
 pir_output_is( <<'CODE', <<'OUTPUT', "segv in get_name" );
 .namespace ['pugs';'main']
 .sub 'main' :main

Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t	Mon Sep  7 17:13:15 2009	(r41118)
+++ trunk/t/pmc/namespace.t	Mon Sep  7 17:38:27 2009	(r41119)
@@ -56,7 +56,7 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(61)
+    plan(63)
 
     create_namespace_pmc()
     verify_namespace_type()
@@ -67,6 +67,7 @@
     get_namespace_from_sub()
     build_namespaces_at_runtime()
     hll_namespaces()
+    anon_function_namespace()
     namespace_methods()
 .end
 
@@ -239,8 +240,6 @@
     pop_eh
 
   test8:
-#     todo(0, "Lookup NameSpace with ISO-8859-1 Name using Unicode Key")
-#     todo(0, "Find sub in ISO-8859-1 NameSpace using Unicode Key")
     push_eh eh8
     $P0 = get_global [ unicode:"Fran\x{00E7}ois" ], "baz"
     $I0 = isnull $P0
@@ -401,6 +400,25 @@
     is($I0, 1, "get_root_namespace only returns NameSpace PMCs")
 .end
 
+.sub 'anon_function_namespace'
+
+    $S0 = <<"CODE"
+        .namespace ["anon_test_internal_ns"]
+        .sub anon_test_internal :main :anon
+            $P0 = get_namespace
+            .return($P0)
+        .end
+CODE
+    $P0 = compreg "PIR"
+    $P1 = $P0($S0)
+    $P2 = $P1()
+    $S0 = typeof $P2
+    is($S0, "NameSpace", "get_namespace from anon sub")
+    $P3 = $P2.'get_name'()
+    $S0 = join "::", $P3
+    is($S0, "parrot::anon_test_internal_ns", "get_namespace name from anon sub")
+.end
+
 .sub 'namespace_methods'
     $P0 = get_namespace
 


More information about the parrot-commits mailing list