Ticket #467: pmc.2.patch

File pmc.2.patch, 1.6 KB (added by ronaldws, 5 years ago)

A revised, updated, patch of tests related to this ticket

  • 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 
     
    112112ok 2 
    113113OUTPUT 
    114114 
     115# http://trac.parrot.org/parrot/ticket/467 
     116# 
     117# If a method is declared in a pmclass declaration it should 
     118# not be appear in the pmclass namespace but it should be accessible 
     119# using find_method on a pmc instance. 
     120# 
     121# When a pmc method sub can be retrieved through a namespace 
     122# it should return true with "defined".  This was a bug.  (remove test 
     123# when retrieval of method subs through namespace issue settled?) 
     124 
     125pir_output_is( <<'CODE', <<'OUTPUT', 'find_method' ); 
     126.sub main :main 
     127  $P0 = new [ 'String' ] 
     128  $P0 = 'AbC' 
     129  $P2 = $P0.'lower'() 
     130  say $P2 
     131 
     132  push_eh _failed 
     133  $P1 = find_method $P0, 'lower' 
     134  say 'find_method ran' 
     135  $P2 = $P1($P0) 
     136  say $P2 
     137  goto _ns_test 
     138 
     139_failed: 
     140  say 'find_method failed' 
     141 
     142_ns_test: 
     143  $P1 = get_hll_global [ 'String' ], 'lower' 
     144 
     145  $P0 = 'AbC' 
     146  push_eh _failed2 
     147  $P2 = $P1($P0) 
     148  print 'lower from namespace ' 
     149  print $P2 
     150  say ' - ran - problem' 
     151  goto _done 
     152 
     153_failed2: 
     154  say 'method from namespace did not run ok' 
     155     
     156_done: 
     157  # definedness failing for sub pmcs 
     158  $I0 = defined $P1 
     159  say $I0 
     160.end 
     161CODE 
     162abc 
     163find_method ran 
     164abc 
     165method from namespace did not run ok 
     1661 
     167OUTPUT 
     168 
     169 
    115170pir_output_is( <<'CODE', <<'OUTPUT', "eq_addr diff" ); 
    116171.sub main 
    117172      new $P0, ['Integer']