Ticket #467: object-meths.patch

File object-meths.patch, 1.4 KB (added by ronaldws, 4 years ago)

New revised test file with one more test for builtin

  • t/pmc/object-meths.t

     
    66use warnings; 
    77use lib qw( . lib ../lib ../../lib ); 
    88use Test::More; 
    9 use Parrot::Test tests => 37; 
     9use Parrot::Test tests => 38; 
    1010 
    1111=head1 NAME 
    1212 
     
    414414OUTPUT 
    415415} 
    416416 
    417 pasm_output_is( <<'CODE', <<'OUTPUT', "find_method" ); 
    418     newclass P3, "Foo" 
    419     new P2, ['Foo'] 
     417pir_output_is( <<'CODE', <<'OUTPUT', "find_method" ); 
     418.sub main :main 
     419    $P3 = newclass "Foo" 
     420    $P2 = new $P3 
    420421 
    421     set S0, "meth" 
    422     find_method P0, P2, S0 
    423     print "main\n" 
    424     callmethodcc P2, P0 
    425     print "back\n" 
     422    $P0 = find_method $P2, 'meth' 
     423    say 'main' 
     424    $P2.$P0() 
     425    say 'back' 
     426    $I0 = defined $P0 
     427    say $I0 
    426428    end 
     429.end 
    427430 
    428431.namespace ["Foo"] 
    429 .pcc_sub :method meth: 
    430     print "in meth\n" 
    431     returncc 
     432.sub meth :method 
     433    say 'in meth' 
     434.end 
    432435CODE 
    433436main 
    434437in meth 
    435438back 
     4391 
    436440OUTPUT 
    437441 
     442pir_output_is( <<'CODE', <<'OUTPUT', 'find_method builtin PMC class' ); 
     443.sub main :main 
     444  $P0 = new [ 'String' ] 
     445  $P0 = 'AbC' 
     446 
     447  $P1 = find_method $P0, 'lower' 
     448  $P2 = $P1($P0) 
     449  say $P2 
     450  $I0 = defined $P1 
     451  say $I0 
     452.end 
     453CODE 
     454abc 
     4551 
     456OUTPUT 
     457 
    438458pasm_error_output_like( <<'CODE', <<'OUTPUT', "find_method - unknown method" ); 
    439459    newclass P2, "Foo" 
    440460    set S0, "nada"