1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/usr/bin/perl -w
use strict;
use Wx::PerlTest;
use Test::More 'tests' => 4;
package MyAbstractNonObject;
use base qw( Wx::PlPerlTestAbstractNonObject );
sub new {
my $class = shift;
my $self = $class->SUPER::new( @_ );
$self->{storedmsg} = 'Foo Bar';
return $self;
}
sub DoGetMessage {
return $_[0]->{storedmsg};
}
package MyNonObject;
use base qw( MyAbstractNonObject );
sub new {
my $class = shift;
my $self = $class->SUPER::new( 'My None Object' );
$self->{storedmsg} = 'Foo Bar Crazy';
return $self;
}
sub DoGetMessage {
return $_[0]->SUPER::DoGetMessage();
}
package main;
my $anonobj = MyAbstractNonObject->new;
my $nonobj = MyNonObject->new;
is( $anonobj->GetMoniker, 'AbstractNonObject', 'Base Moniker Works');
is( $anonobj->GetMessage, 'Foo Bar', 'Custom Message From Hash Object' );
is( $nonobj->GetMoniker, 'My None Object', 'Derived Moniker Works');
is( $nonobj->GetMessage, 'Foo Bar Crazy', 'Derived Non obj' );
# Local variables: #
# mode: cperl #
# End: #
|