Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a test for failing invert_ip()

  • Loading branch information...
commit 65379ca3c983dbd37fdf3989588194dd92461891 1 parent 2274e6f
Sawyer X xsawyerx authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 t/invert.t
17 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';
+
Please sign in to comment.
Something went wrong with that request. Please try again.