Skip to content

Commit

Permalink
Add some test
Browse files Browse the repository at this point in the history
  • Loading branch information
marioct committed Feb 9, 2016
1 parent 5801643 commit 55fb986
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 58 deletions.
5 changes: 4 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Revision history for Perl extension SMS::Send::Facilitamovel.

0.02 Tue Feb 8 19:00:00 2016
- Fix tests

0.01 Tue Feb 2 23:06:25 2016
- original version; created by h2xs 1.23 with options
-AX SMS::Send::Facilitamovel
-AX SMS::Send::BR::Facilitamovel

51 changes: 42 additions & 9 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,12 +1,45 @@
use 5.018001;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'SMS::Send::BR::Facilitamovel',
VERSION_FROM => 'lib/SMS/Send/BR/Facilitamovel.pm', # finds $VERSION
PREREQ_PM => {}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/SMS/Send/Facilitamovel.pm', # retrieve abstract from module
AUTHOR => 'Mario Celso Teixeira <marioct37@gmail.com>') : ()),

my %WriteMakefileArgs = (
'NAME' => 'SMS::Send::BR::Facilitamovel',
'VERSION' => '0.02',
'ABSTRACT' => 'SMS::Send driver for the Facilita Movel SMS service',
'AUTHOR' => 'Mario Celso Teixeira <marioct37@gmail.com>',
'BUILD_REQUIRES' => {
'English' => '0',
'Carp' => '0',
'HTTP::Tiny' => '0',
'URI::Escape' => '0',
'SMS::Send' => '0',
'Test::More' => '0'
},
'CONFIGURE_REQUIRES' => {
'ExtUtils::MakeMaker' => '6.31',
},
'PREREQ_PM' => {
'SMS::Send::Driver' => '0',
},
'test' => {
'TESTS' => 't/*.t'
}
);

unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
}
else {
$pp->{$mod} = $br->{$mod};
}
}
}

delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

WriteMakefile(%WriteMakefileArgs);

13 changes: 4 additions & 9 deletions README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

SMS::Send::BR::Facilitamovel - L<SMS::Send|https://metacpan.org/pod/SMS::Send> driver for the Facilitamovel service

=head1 VERSION

0.01

=head1 SYNOPSIS

use SMS::Send;
Expand Down Expand Up @@ -40,10 +36,10 @@ To install this module type the following:

This module requires these other modules and libraries:

Carp
HTTP::Tiny
URI::Escape
SMS::Send::Driver
Carp
HTTP::Tiny
URI::Escape
SMS::Send::Driver

=head1 COPYRIGHT AND LICENCE

Expand All @@ -53,4 +49,3 @@ This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.18.1 or,
at your option, any later version of Perl 5 you may have available.


9 changes: 9 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = SMS-Send-BR-Facilitamovel
author = Mario Celso Teixeira <marioct37@gmail.com>
license = Perl_5
copyright_holder = Mario Celso Teixeira
copyright_year = 2016

version = 0.02

[@Basic]
12 changes: 6 additions & 6 deletions lib/SMS/Send/BR/Facilitamovel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use warnings;

package SMS::Send::BR::Facilitamovel;

$SMS::Send::BR::Facilitamovel::VERSION = '0.001';
$SMS::Send::BR::Facilitamovel::VERSION = '0.02';

# ABSTRACT: SMS::Send driver for the Facilita Movel SMS service

# ABSTRACT: SMS::Send driver for the Facilita Movel SMS service

use Carp;
use HTTP::Tiny;
use URI::Escape qw( uri_escape );
Expand Down Expand Up @@ -59,12 +59,12 @@ sub send_sms {
die $response->{content}
unless $response->{success};

my $response_message = $response->{content};
my @response_message = split /[;]+/, $response->{content};

return 1
if $response_message->{statusCode} =~ /^6\d\d/;
if $response_message[0] != "6";

$@ = $response_message;
$@ = @response_message;

return 0;
}
Expand Down
51 changes: 51 additions & 0 deletions t/00-compile.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
use 5.006;
use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051

use Test::More;

plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);

my @module_files = (
'SMS/Send/BR/Facilitamovel.pm'
);



# no fake home requested

my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';

use File::Spec;
use IPC::Open3;
use IO::Handle;

open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";

my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;

my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");

if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}



is(scalar(@warnings), 0, 'no warnings found')
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};


33 changes: 0 additions & 33 deletions t/SMS-Send-BR-Facilitamovel.t

This file was deleted.

0 comments on commit 55fb986

Please sign in to comment.