File: 10-ifconfig.t

package info (click to toggle)
libsys-hostip-perl 2.120-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: perl: 487; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 746 bytes parent folder | download | duplicates (4)
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');