Index: t/pmc/pmc.t =================================================================== --- t/pmc/pmc.t (revision 37336) +++ t/pmc/pmc.t (working copy) @@ -7,7 +7,7 @@ use lib qw( . lib ../lib ../../lib ); use Test::More; -use Parrot::Test tests => 15; +use Parrot::Test tests => 16; use Parrot::PMC '%pmc_types'; =head1 NAME @@ -96,6 +96,57 @@ /Method 'no_such_meth' not found for invocant of class 'Integer'/ OUTPUT +# +# If a method is declared in a pmclass declaration it should +# not be appear in the pmclass namespace but it should be accessible +# using find_method on a pmc instance. +# +# Currently a pmc method sub can be retrieved through a namespace +# but does not return true with "defined". This is a bug. (remove test +# when others pass?) +# + +pir_output_is( <<'CODE', <<'OUTPUT', 'find_method' ); +.sub main :main + $P0 = new [ 'String' ] + $P0 = 'AbC' + $P2 = $P0.'lower'() + say $P2 + + push_eh _failed + $P1 = find_method $P0, 'lower' + say 'find_method ran' + goto _failed1 + +_failed: + say 'find_method failed' + + $P1 = get_hll_global [ 'String' ], 'lower' + + $P0 = 'AbC' + push_eh _failed1 + $P2 = $P1($P0) + print 'lower from namespace ' + print $P2 + say ' - ran - problem' + goto _done + +_failed1: + say 'method from namespace did not run ok' + +_done: + # definedness failing for sub pmcs + $I0 = defined $P1 + say $I0 +.end +CODE +abc +find_method ran +method from namespace did not run ok +1 +OUTPUT + + pasm_output_is( <<'CODE', <<'OUTPUT', "eq_addr same" ); new P0, ['Integer'] set P1, P0