X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fextendingrect.t;h=b0e652ec8ea633452a9ca97e90fe61f7dd2250d8;hb=7dda1934e967f3a8e07a01546aa498b4e53a08ed;hp=e6733c6c1a9728a9316cddf287790480043bc995;hpb=bdd52efa8fc2c240f12d7b7d9f40e7794996e3a4;p=sdlgit%2FSDL_perl.git diff --git a/t/extendingrect.t b/t/extendingrect.t index e6733c6..b0e652e 100644 --- a/t/extendingrect.t +++ b/t/extendingrect.t @@ -3,17 +3,12 @@ use base 'SDL::Rect'; sub new { my $class = shift; - my $x = shift || 0; - my $y = shift || 0; - my $w = shift || 0; - my $h = shift || 0; - my $self = SDL::Rect->new($x, $y, $w, $h); - unless ($$self) { + my $self = $class->SUPER::new(@_); + unless (ref $self) { require Carp; Carp::croak SDL::GetError(); } - bless $self, $class; - return $self; + return bless $self => $class;; } @@ -25,11 +20,11 @@ sub foo { package main; use Test::More tests => 6; -my $rect = MyRect->new; +my $rect = MyRect->new(0,0,0,0); isa_ok($rect, 'SDL::Rect'); isa_ok($rect, 'MyRect'); -can_ok($rect, qw(x y top left w h width height)); +can_ok($rect, qw(x y w h)); can_ok($rect, qw(new foo)); $rect->x(10);