Permalink
Browse files

A better test case for file. Also adding strict and warnings to some …

…libraries
  • Loading branch information...
1 parent 60070b7 commit 116b863768040daa2af199f65b199411c6f53d24 @kthakore kthakore committed Nov 24, 2010
Showing with 27 additions and 7 deletions.
  1. +1 −0 lib/SDLx/FPS.pm
  2. +5 −4 lib/SDLx/Sound.pm
  3. +21 −3 t/00-load.t
View
1 lib/SDLx/FPS.pm
@@ -1,5 +1,6 @@
package SDLx::FPS;
use strict;
+use warnings;
use SDL::GFX::Framerate;
use SDL::GFX::FPSManager;
use Carp;
View
9 lib/SDLx/Sound.pm
@@ -1,5 +1,6 @@
package SDLx::Sound;
-
+use strict;
+use warnings;
use Carp;
use SDL;
@@ -18,7 +19,7 @@ sub new {
my $class = shift;
my $self = {@_};
bless ($self, $class);
- _initAudio() unless $audio_ok;
+ _initAudio() unless $audioInited;
$self->{supported} = _initMixer();
return $self;
}
@@ -36,14 +37,14 @@ sub _initMixer {
my %init = ();
# Short circuit if we have and older version of SDL_Mixer
- return \%$init unless $init_flags;
+ return \%init unless $init_flags;
$init{ mp3 } = 1 if $init_flags & MIX_INIT_MP3;
$init{ mod } = 1 if $init_flags & MIX_INIT_MOD;
$init{ flac } = 1 if $init_flags & MIX_INIT_FLAC;
$init{ ogg } = 1 if $init_flags & MIX_INIT_OGG;
- return \%$init
+ return \%init
}
sub load {
View
24 t/00-load.t
@@ -1,6 +1,7 @@
use strict;
use warnings;
use Test::Most 'bail';
+use Test::Strict;
BEGIN {
my @modules = qw /
@@ -68,10 +69,27 @@ BEGIN {
SDLx::Controller::State
SDLx::Controller::Timer
- SDLx::Sound
+ SDLx::Sound
/;
- plan tests => scalar @modules;
- use_ok $_ foreach @modules;
+ my $tests = scalar @modules;
+ plan tests => $tests * 4;
+
+ foreach( @modules )
+ {
+ use_ok $_ ;
+
+ my $file = $_;
+ $file =~ s/::/\//g;
+
+ $file = 'lib/'.$file.'.pm';
+
+ syntax_ok $file ;
+
+ strict_ok $file ;
+
+ warnings_ok $file;
+
+ }
}

0 comments on commit 116b863

Please sign in to comment.