1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!perl
use strict;
use warnings;
use Test::More;
use Sys::HostIP;
plan tests => $^O =~ qr/(MSWin32|cygwin)/x ? 5 : 7;
{
## no critic qw(TestingAndDebugging::ProhibitNoWarnings)
no warnings 'redefine';
*Sys::HostIP::_get_ifconfig_binary = sub {
my $object = shift;
isa_ok( $object, 'Sys::HostIP' );
cmp_ok( @_, '==', 0, 'Got no parameters' );
return 'test';
};
*Sys::HostIP::_get_interface_info = sub {};
}
is( Sys::HostIP->ifconfig, 'test', 'ifconfig without object' );
my $object = Sys::HostIP->new;
is( $object->ifconfig('my_path'), 'my_path', 'ifconfig with object and param' );
$object->{'ifconfig'} = 'my_ifconfig';
is( $object->ifconfig, 'my_ifconfig', 'ifconfig without path');
|