File: irc.t

package info (click to toggle)
liburi-perl 5.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 948 kB
  • sloc: perl: 3,936; makefile: 4
file content (38 lines) | stat: -rw-r--r-- 890 bytes parent folder | download
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
32
33
34
35
36
37
38
use strict;
use warnings;

use Test::More tests => 10;

use URI ();
my $uri;

$uri = URI->new("irc://PerlUser\@irc.perl.org:6669/#libwww-perl,ischannel,isnetwork?key=bazqux");

is($uri, "irc://PerlUser\@irc.perl.org:6669/#libwww-perl,ischannel,isnetwork?key=bazqux");
is($uri->port, 6669);

# add a password
$uri->password('foobar');

is($uri->userinfo, "PerlUser:foobar");

my @opts = $uri->options;
is_deeply(\@opts, [qw< key bazqux >]);

$uri->options(foo => "bar", bar => "baz");

is($uri->query, "foo=bar&bar=baz");
is($uri->host, "irc.perl.org");
is($uri->path, "/#libwww-perl,ischannel,isnetwork");

# add a bunch of flags to clean up
$uri->path("/SineSwiper,isnick,isnetwork,isserver,needpass,needkey");
$uri = $uri->canonical;

is($uri->path, "/SineSwiper,isuser,isnetwork,needpass,needkey");

# ports and secure-ness
is($uri->secure, 0);

$uri->port(undef);
is($uri->port, 6667);