Help language development. Donate to The Perl Foundation

Net::netent zef:lizmat last updated on 2021-09-09

t/getnetbyname.t
use v6.*;
use Test;
use Net::netent;

plan 8;

my $netname = getnetent.name;
ok ?$netname, 'did we get a net name';

is getnetbyname($netname).name, $netname,
  'did we find ourselves by name';

my $addrtype = getnetbyname($netname).addrtype;
my $net      = getnetbyname($netname).net;
is getnetbyaddr($net,$addrtype).name, $netname,
  'did we find ourselves by addr';

is setnetent(False), 1, 'does setnetent(False) return the undocumented 1';
is setnetent(True),  1, 'does setnetent(True) return the undocumented 1';

is endnetent(), 1, 'does endnetent return the undocumented 1';

is getnetbyname("thisnameshouldnotexist"), Nil,
  'did lookup by non-existing name fail';
is getnetbyaddr(666, 42), Nil,
  'did lookup by non-existing addr fail';

# vim: expandtab shiftwidth=4