Added mem leak test for core
Kartik Thakore [Thu, 22 Oct 2009 01:48:48 +0000 (21:48 -0400)]
t/core_memleak.t [new file with mode: 0644]
t/core_overlay.t

diff --git a/t/core_memleak.t b/t/core_memleak.t
new file mode 100644 (file)
index 0000000..bb7f135
--- /dev/null
@@ -0,0 +1,30 @@
+#!perl
+use strict;
+use warnings;
+use Test::More;
+use SDL;
+
+
+sub overlay_leak()
+{
+
+SDL::Init(SDL_INIT_VIDEO);
+
+my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE );
+
+my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display);
+
+$overlay = undef;
+
+$display = undef;
+
+}
+
+
+eval 'use Test::Valgrind';
+plan skip_all => 'Test::Valgrind is required to test your distribution with valgrind' if $@;
+
+overlay_leak();
+
+
+
index 38cb83a..b80fdba 100644 (file)
@@ -14,5 +14,10 @@ my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display);
 
 isa_ok( $overlay, 'SDL::Overlay');
 
+$overlay = undef;
+
+$display = undef;
+
+