File: encoding.t

package info (click to toggle)
libhttp-daemon-perl 6.12-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 492 kB
  • sloc: perl: 715; makefile: 2
file content (27 lines) | stat: -rwxr-xr-x 599 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 Test::More;

use HTTP::Daemon ();
use Socket qw( AF_INET6 );

{
    no warnings 'redefine';
    local *IO::Socket::sockdomain = sub { return Socket::AF_INET6 };
    local *IO::Socket::IP::sockhost
        = sub { return q{fe80::250:54ff:fe00:f01%ens3} };

    my $d = HTTP::Daemon->new;
    is($d->sockhost, q{fe80::250:54ff:fe00:f01%ens3}, 'we overrode sockhost');
    is($d->sockdomain, Socket::AF_INET6, 'we overrode sockdomain');

    like(
        $d->url,
        qr{\Q[fe80::250:54ff:fe00:f01%25ens3]\E},
        '% is encoded in host'
    );

}

done_testing;