Permalink
Browse files

adding to invert_ip test

  • Loading branch information...
1 parent d234f8a commit 8e2a60872d80a7ba5eab0c2d286c97538d848322 @xsawyerx xsawyerx committed Jun 10, 2010
Showing with 15 additions and 5 deletions.
  1. +2 −2 lib/Net/IPAddress/Minimal.pm
  2. +13 −3 t/invert.t
@@ -69,8 +69,8 @@ sub invert_ip {
my %responses = (
ip => sub { ip_to_num( $ip_classes ) },
num => sub { num_to_ip( $input_str ) },
- err => sub { 'Illegal string. Please use IPv4 strings or numbers' },
- empty => sub { 'Empty string. Please use IPv4 strings or numbers' },
+ err => sub { 'Illegal string. Please use IPv4 strings or numbers.' },
+ empty => sub { 'Empty string. Please use IPv4 strings or numbers.' },
);
# This is a dispatch table, instead of a big ugly if block / switch
View
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 6;
use Net::IPAddress::Minimal 'invert_ip';
my $ip_a = '7.91.205.21';
@@ -26,6 +26,16 @@ my $ip_num = 123456789;
invert_ip($ip_a);
invert_ip($ip_num);
-invert_ip('waka waka');
-invert_ip();
+
+is(
+ invert_ip('waka waka'),
+ 'Illegal string. Please use IPv4 strings or numbers.',
+ 'got illegal string from invert_ip()',
+);
+
+is(
+ invert_ip(),
+ 'Empty string. Please use IPv4 strings or numbers.',
+ 'got empty string from invert_ip()',
+);

0 comments on commit 8e2a608

Please sign in to comment.