# New Ticket Created by Sam Vilain # Please include the string: [perl #41456] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41456 >
From: <[EMAIL PROTECTED]> Check that if we create an inheritance tree with addparent, that it performs like one made with subclass --- t/pmc/object-meths.t | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/t/pmc/object-meths.t b/t/pmc/object-meths.t index 38cfbbf..77ae501 100644 --- a/t/pmc/object-meths.t +++ b/t/pmc/object-meths.t @@ -6,7 +6,7 @@ use strict; use warnings; use lib qw( . lib ../lib ../../lib ); use Test::More; -use Parrot::Test tests => 38; +use Parrot::Test tests => 39; =head1 NAME @@ -942,11 +942,45 @@ CODE foofoo OUTPUT -pir_output_is( <<'CODE', <<'OUTPUT', "super 1 - two classes" ); +pir_output_is( <<'CODE', <<'OUTPUT', "super 1 - two classes, subclass" ); .sub main :main - .local pmc o, cl + .local pmc o, cl, cl2 cl = newclass 'Parent' - cl = subclass cl, 'Child' + #cl = subclass cl, 'Child' + cl2 = newclass 'Child' + addparent cl2, cl + o = new 'Child' + o."foo"() +.end + +.namespace ['Parent'] +.sub foo :method + print "Parent foo\n" + self."bar"() +.end +.sub bar :method + print "Parent bar\n" +.end + +.namespace ['Child'] +.sub foo :method + print "Child foo\n" + .local pmc s + s = new .Super, self + s."foo"() +.end +CODE +Child foo +Parent foo +Parent bar +OUTPUT + +pir_output_is( <<'CODE', <<'OUTPUT', "super 2 - two classes, addparent" ); +.sub main :main + .local pmc o, p, c + p = newclass 'Parent' + c = newclass 'Child' + addparent c, p o = new 'Child' o."foo"() .end @@ -973,7 +1007,7 @@ Parent foo Parent bar OUTPUT -pir_output_is( <<'CODE', <<'OUTPUT', "super 2 - three classes" ); +pir_output_is( <<'CODE', <<'OUTPUT', "super 3 - three classes" ); .sub main :main .local pmc o, p, c, g p = newclass 'Parent' @@ -1011,7 +1045,7 @@ Child foo Parent foo OUTPUT -pir_output_is( <<'CODE', <<'OUTPUT', "super 3 - diamond" ); +pir_output_is( <<'CODE', <<'OUTPUT', "super 4 - diamond" ); .sub main :main .local pmc o, p, c1, c2, i p = newclass 'Parent'