From: Kartik Thakore Date: Fri, 18 Sep 2009 15:35:59 +0000 (-0400) Subject: Trying to fix broken timer test with eval X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2f3910be03e91d91e856f463b64fd9d5fa708bc;p=sdlgit%2FSDL_perl.git Trying to fix broken timer test with eval --- diff --git a/t/timerpm.t b/t/timerpm.t index 430c2f7..f7fb87c 100644 --- a/t/timerpm.t +++ b/t/timerpm.t @@ -31,21 +31,32 @@ # # basic testing of SDL::Timer -BEGIN { - unshift @INC, 'blib/lib','blib/arch'; -} - use strict; use SDL; use SDL::Config; - use Test::More; -if (SDL::Init(SDL_INIT_TIMER) < 0 ) +BEGIN { + unshift @INC, 'blib/lib','blib/arch'; +} + +sub check_fail_timer +{ + my $ret = 0; + eval + { + $ret = SDL::Init(SDL_INIT_TIMER); + die "as"; + }; + return 1 if (@_ or $ret == -1); + return 0; +} + +if( check_fail_timer() ) { plan( skip_all => "Cannot initialize timer!!" ); - } + plan ( tests => 4 ); use_ok( 'SDL::Timer' );