File: 03cache.t

package info (click to toggle)
libnet-dns-lite-perl 0.12-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 236 kB
  • sloc: perl: 1,821; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;

use Socket qw();
use Test::More;
use Test::Requires qw(Cache::LRU);

BEGIN {
    plan skip_all => 'These tests need network access'
        if $ENV{NO_NETWORK_TESTING};

    use_ok('Net::DNS::Lite');
};

my $cache = $Net::DNS::Lite::CACHE = Cache::LRU->new(
    size => 1024,
);

ok Net::DNS::Lite::inet_aton('example.com');
my $value = $cache->get('in a example.com');
ok $value;
$value->[1] = time + 10000;
splice @{$value->[0]{an}}, 1;
$value->[0]{an}[0][4] = "127.0.0.1";
is Net::DNS::Lite::inet_aton('example.com'), Socket::inet_aton('127.0.0.1');

done_testing;