Permalink
Browse files

adding a test for failing invert_ip()

  • Loading branch information...
1 parent 2274e6f commit 65379ca3c983dbd37fdf3989588194dd92461891 @xsawyerx xsawyerx committed Jun 10, 2010
Showing with 16 additions and 1 deletion.
  1. +16 −1 t/invert.t
View
@@ -4,8 +4,9 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 9;
use Net::IPAddress::Minimal 'invert_ip';
+use Test::Exception;
my $ip_a = '7.91.205.21';
my $ip_num = 123456789;
@@ -39,3 +40,17 @@ is(
'got empty string from invert_ip()',
);
+{
+ no warnings qw/redefine once/;
+
+ *Net::IPAddress::Minimal::test_string_structure = sub {
+ cmp_ok( scalar @_, '==', 1, 'no. of param test_string_structure()' );
+ is( $_[0], 'test', 'correct param for test_string_structure()' );
+ return 'waka waka';
+ };
+}
+
+throws_ok { invert_ip('test') }
+ qr{^Could not convert IP string / number due to unknown error},
+ 'invert_ip() can really die';
+

0 comments on commit 65379ca

Please sign in to comment.