Ticket #467: pmc.patch

File pmc.patch, 1.5 KB (added by ronaldws, 13 years ago)
  • t/pmc/pmc.t

     
    77use lib qw( . lib ../lib ../../lib ); 
    88 
    99use Test::More; 
    10 use Parrot::Test tests => 15; 
     10use Parrot::Test tests => 16; 
    1111use Parrot::PMC '%pmc_types'; 
    1212 
    1313=head1 NAME 
     
    9696/Method 'no_such_meth' not found for invocant of class 'Integer'/ 
    9797OUTPUT 
    9898 
     99# 
     100# If a method is declared in a pmclass declaration it should 
     101# not be appear in the pmclass namespace but it should be accessible 
     102# using find_method on a pmc instance. 
     103# 
     104# Currently a pmc method sub can be retrieved through a namespace 
     105# but does not return true with "defined".  This is a bug.  (remove test 
     106# when others pass?) 
     107# 
     108 
     109pir_output_is( <<'CODE', <<'OUTPUT', 'find_method' ); 
     110.sub main :main 
     111  $P0 = new [ 'String' ] 
     112  $P0 = 'AbC' 
     113  $P2 = $P0.'lower'() 
     114  say $P2 
     115 
     116  push_eh _failed 
     117  $P1 = find_method $P0, 'lower' 
     118  say 'find_method ran' 
     119  goto _failed1 
     120 
     121_failed: 
     122  say 'find_method failed' 
     123 
     124  $P1 = get_hll_global [ 'String' ], 'lower' 
     125 
     126  $P0 = 'AbC' 
     127  push_eh _failed1 
     128  $P2 = $P1($P0) 
     129  print 'lower from namespace ' 
     130  print $P2 
     131  say ' - ran - problem' 
     132  goto _done 
     133 
     134_failed1: 
     135  say 'method from namespace did not run ok' 
     136     
     137_done: 
     138  # definedness failing for sub pmcs 
     139  $I0 = defined $P1 
     140  say $I0 
     141.end 
     142CODE 
     143abc 
     144find_method ran 
     145method from namespace did not run ok 
     1461 
     147OUTPUT 
     148 
     149 
    99150pasm_output_is( <<'CODE', <<'OUTPUT', "eq_addr same" ); 
    100151      new P0, ['Integer'] 
    101152      set P1, P0