Fixed the pod path in archive
[sdlgit/SDL_perl.git] / t / extendingrect.t
index c1bbb9e..b0e652e 100644 (file)
@@ -2,24 +2,29 @@ package MyRect;
 use base 'SDL::Rect';
 
 sub new {
-    my $class = shift;
-    my $self = {};
-    bless $self, $class;
+       my $class = shift;
+       my $self = $class->SUPER::new(@_);
+       unless (ref $self) {
+               require Carp;
+               Carp::croak SDL::GetError();
+       }
+       return bless $self => $class;;
+
 }
 
 sub foo {
-    my $self = shift;
-    return $self->x;
+       my $self = shift;
+       return $self->x;
 }
 
 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);