File: 07_callback.t

package info (click to toggle)
libwx-perl 1%3A0.9928-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,300 kB
  • ctags: 2,322
  • sloc: cpp: 11,044; perl: 8,646; ansic: 710; makefile: 48
file content (50 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download | duplicates (5)
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: #