Index: t/pmc/pmc.t =================================================================== --- t/pmc/pmc.t (revision 43583) +++ 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 @@ -112,6 +112,61 @@ ok 2 OUTPUT +# http://trac.parrot.org/parrot/ticket/467 +# +# 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. +# +# When a pmc method sub can be retrieved through a namespace +# it should return true with "defined". This was a bug. (remove test +# when retrieval of method subs through namespace issue settled?) + +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' + $P2 = $P1($P0) + say $P2 + goto _ns_test + +_failed: + say 'find_method failed' + +_ns_test: + $P1 = get_hll_global [ 'String' ], 'lower' + + $P0 = 'AbC' + push_eh _failed2 + $P2 = $P1($P0) + print 'lower from namespace ' + print $P2 + say ' - ran - problem' + goto _done + +_failed2: + 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 +abc +method from namespace did not run ok +1 +OUTPUT + + pir_output_is( <<'CODE', <<'OUTPUT', "eq_addr diff" ); .sub main new $P0, ['Integer']