Skip to content

Commit

Permalink
Added perltidy tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
larryl committed Mar 21, 2011
1 parent 5b6d8b8 commit e00bd83
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
WebService-ScormCloud-*.tar.gz
cover_db
Makefile
Makefile.old
Expand Down
1 change: 0 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ WriteMakefile(
'Carp' => 0,
'Data::Dump' => 0,
'Digest::MD5' => 0,
'ExtUtils::MakeMaker' => 0,
'File::Spec' => 0,
'HTTP::Request::Common' => 0,
'LWP::UserAgent' => 0,
Expand Down
21 changes: 10 additions & 11 deletions lib/WebService/ScormCloud.pm
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ API call returns undef instead of the expected object.
=cut

has 'last_error_data' => (
is => 'rw',
isa => 'ArrayRef',
default => sub { return [] },
);
is => 'rw',
isa => 'ArrayRef',
default => sub { return [] },
);

=item last_error_msg
Expand All @@ -152,22 +152,21 @@ API call returns undef instead of the expected object.
=cut

my %error_codes = (
);
my %error_codes = ();

sub last_error_msg
{
my ($self) = @_;

my @msg = ();

foreach my $error (@{$self->last_error_data})
{
my $msg = $error->{msg};
$msg =~ s/^\s+//;
$msg =~ s/\s+$//;
$msg =~ s/\s+/ /;
$msg =~ s/ associated with appid \[.*?\]//g;
$msg =~ s/^\s+//msx;
$msg =~ s/\s+$//msx;
$msg =~ s/\s+/ /msx;
$msg =~ s/ associated with appid \[.*?\]//gmsx;

push @msg, $msg;
}
Expand Down
4 changes: 4 additions & 0 deletions t/_perltidyrc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

-npro
-gnu

30 changes: 30 additions & 0 deletions t/perltidy.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!perl -T

use strict;
use warnings;

use File::Spec;
use Test::More;

unless ($ENV{TEST_AUTHOR})
{
plan skip_all =>
'Set $ENV{TEST_AUTHOR} to a true value to run perltidy tests.';
}

eval { require Test::PerlTidy };
if ($@)
{
plan skip_all => 'Test::PerlTidy required to run perltidy tests.';
}

eval { require Perl::Tidy };
if ($@)
{
plan skip_all => 'Perl::Tidy required to run perltidy tests.';
}

my $perltidyrc = File::Spec->catfile('t', '_perltidyrc.txt');

Test::PerlTidy::run_tests(perltidyrc => $perltidyrc);

0 comments on commit e00bd83

Please sign in to comment.