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

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Mon Sep 7 17:50:47 UTC 2009


Author: whiteknight
Date: Mon Sep  7 17:50:47 2009
New Revision: 41120
URL: https://trac.parrot.org/parrot/changeset/41120

Log:
[t] convert one more 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:38:27 2009	(r41119)
+++ trunk/t/pmc/namespace-old.t	Mon Sep  7 17:50:47 2009	(r41120)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 44;
+use Parrot::Test tests => 43;
 use Parrot::Config;
 
 =head1 NAME
@@ -23,20 +23,6 @@
 
 =cut
 
-# How do we convert this to PIR?
-pir_output_is( <<'CODE', <<'OUTPUT', "segv in get_name" );
-.namespace ['pugs';'main']
-.sub 'main' :main
-    $P0 = find_name "&say"
-    $P0()
-.end
-.sub "&say"
-    say "ok"
-.end
-CODE
-ok
-OUTPUT
-
 pir_output_is( <<'CODE', <<'OUT', "unicode namespace, global" );
 .namespace [ unicode:"Fran\xe7ois" ]
 

Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t	Mon Sep  7 17:38:27 2009	(r41119)
+++ trunk/t/pmc/namespace.t	Mon Sep  7 17:50:47 2009	(r41120)
@@ -56,7 +56,7 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(63)
+    plan(64)
 
     create_namespace_pmc()
     verify_namespace_type()
@@ -68,6 +68,7 @@
     build_namespaces_at_runtime()
     hll_namespaces()
     anon_function_namespace()
+    find_name_opcode()
     namespace_methods()
 .end
 
@@ -419,6 +420,33 @@
     is($S0, "parrot::anon_test_internal_ns", "get_namespace name from anon sub")
 .end
 
+.sub 'find_name_opcode'
+
+    $S0 = <<'CODE'
+        .namespace ['pugs';'main']
+        .sub 'main' :main
+            push_eh just_in_case
+            $P0 = find_name "&say"
+            $P0()
+            $I0 = 1
+            goto the_end
+          just_in_case:
+            $I0 = 0
+          the_end:
+            pop_eh
+            .return($I0)
+        .end
+
+        .sub "&say"
+            noop
+        .end
+CODE
+    $P0 = compreg "PIR"
+    $P1 = $P0($S0)
+    $I0 = $P1()
+    is($I0, 1, "find_name sub with sigil in namespace")
+.end
+
 .sub 'namespace_methods'
     $P0 = get_namespace
 


More information about the parrot-commits mailing list