#!perl # in a file: baseobj.t use strict; use warnings; package main; use Test::More tests => 13; BEGIN { use_ok("BaseObj"); use_ok("Inherit"); } { my $base = BaseObj->new; isa_ok($base, 'BaseObj'); can_ok('BaseObj',qw/new go/); is($base->go, "Going home to California in the West Coast\n", "Test go method of BaseObj object"); my $more = Inherit->new; isa_ok($more, 'BaseObj'); isa_ok($more, 'Inherit'); can_ok('Inherit',qw/new go where/); is($more->go, "Going home to California in the West Coast\n" . "San Diego is home to the Padres\n", "Test go method of Inherit object"); is($more->where, "San Diego is home to the Padres\n", "Test where method of Inherit object"); $base->home("New Jersey"); $base->region("East Coast"); is($base->go, "Going home to New Jersey in the East Coast\n", "Test go AUTOLOAD methods of BaseObj object"); $more->home("New York"); $more->region("East Coast"); $more->town("New York"); $more->team("Mets"); is($more->go, "Going home to New York in the East Coast\n" . "New York is home to the Mets\n", "Test go AUTOLOAD methods of Inherit object"); is($more->where, "New York is home to the Mets\n", "Test where AUTOLOAD method of Inherit object"); }