Ticket #285: vtableoverride.patch

File vtableoverride.patch, 2.3 KB (added by ronaldws, 6 years ago)

Patch to test script relevant to feature.

  • t/oo/vtableoverride.t

     
    1818 
    1919.sub main :main 
    2020    .include 'test_more.pir' 
    21     plan(12) 
     21    plan(15) 
    2222 
    2323    newclass_tests() 
    2424    subclass_tests() 
    2525    vtable_implies_self_tests() 
     26    mmd_override_not_proxied() 
    2627.end 
    2728 
    2829.sub 'newclass_tests' 
     
    8687  ok( $I0, ':vtable should imply the self parameter' ) 
    8788.end 
    8889 
     90.sub 'mmd_override_not_proxied' 
     91    .local pmc integer_cl, three_cl, three_obj 
     92 
     93    get_class integer_cl, 'Integer' 
     94    subclass three_cl, integer_cl, 'Three' 
     95    three_cl.'add_attribute'('marker') 
     96    three_cl.'add_attribute'('zero_marker') 
     97    three_cl.'add_attribute'('one_marker') 
     98    three_obj = new 'Three' 
     99 
     100    # zero_marker/one_marker initialization should go in init vtable method 
     101    # -- todo because seems to seg fault now 
     102    $P0 = new ['Integer'] 
     103    $P0 = 0 
     104    setattribute three_obj, 'zero_marker', $P0 
     105    $P0 = new ['Integer'] 
     106    $P0 = 1 
     107    setattribute three_obj, 'one_marker', $P0 
     108    
     109    # not mmd but basic test 
     110    three_obj.'clear_marker'() 
     111    $I0 = three_obj 
     112    three_obj.'verify_marker'('assign to int register calls vtable get_integer override') 
     113 
     114    .local pmc i 
     115    i = new 'Integer' 
     116    i = 2 
     117 
     118    three_obj.'clear_marker'() 
     119    $P0 = sub three_obj, i 
     120    three_obj.'verify_marker'('subtract calls vtable get_integer override') 
     121     
     122    three_obj.'clear_marker'() 
     123    $I0 = cmp_num three_obj, i 
     124    three_obj.'verify_marker'('cmp_num with calls vtable get_integer override') 
     125.end 
     126 
    89127.namespace [ 'MyObject' ] 
    90128 
    91129.sub '__onload' :anon :init 
     
    169207    .return( 1 ) 
    170208.end 
    171209 
     210.namespace ['Three'] 
     211 
     212.sub '' :vtable('get_integer') :method 
     213    $P0 = getattribute self, 'one_marker' 
     214    setattribute self, 'marker', $P0 
     215    .return (3) 
     216.end 
     217 
     218.sub clear_marker :method 
     219    $P0 = getattribute self, 'zero_marker' 
     220    setattribute self, 'marker', $P0 
     221.end 
     222 
     223.sub verify_marker :method 
     224    .param string test_description 
     225    .local pmc get_integer_marker 
     226 
     227    get_integer_marker = getattribute self, 'marker' 
     228    is(get_integer_marker, 1, test_description) 
     229.end 
     230 
    172231# Local Variables: 
    173232#   mode: pir 
    174233#   fill-column: 100