Skip to content

Commit 3e5c614

Browse files
committed
Split up secure protocol tests to their own unit test file
1 parent ff02b2b commit 3e5c614

File tree

5 files changed

+46
-40
lines changed

5 files changed

+46
-40
lines changed

t/ftp.t

+1-32
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,25 @@
11
use strict;
22
use warnings;
33

4-
use Test::More tests => 23;
4+
use Test::More tests => 15;
55

66
use URI ();
77
my $uri;
88

99
$uri = URI->new("ftp://ftp.example.com/path");
1010

1111
is($uri->scheme, "ftp");
12-
1312
is($uri->host, "ftp.example.com");
14-
1513
is($uri->port, 21);
16-
1714
is($uri->secure, 0);
18-
1915
is($uri->encrypt_mode, undef);
20-
2116
is($uri->user, "anonymous");
22-
2317
is($uri->password, 'anonymous@');
2418

2519
$uri->userinfo("gisle\@aas.no");
2620

2721
is($uri, "ftp://gisle%40aas.no\@ftp.example.com/path");
28-
2922
is($uri->user, "gisle\@aas.no");
30-
3123
is($uri->password, undef);
3224

3325
$uri->password("secret");
@@ -37,29 +29,6 @@ is($uri, "ftp://gisle%40aas.no:secret\@ftp.example.com/path");
3729
$uri = URI->new("ftp://gisle\@aas.no:secret\@ftp.example.com/path");
3830

3931
is($uri, "ftp://gisle\@aas.no:secret\@ftp.example.com/path");
40-
4132
is($uri->userinfo, "gisle\@aas.no:secret");
42-
4333
is($uri->user, "gisle\@aas.no");
44-
4534
is($uri->password, "secret");
46-
47-
$uri = URI->new("ftps://ftp.example.com/path");
48-
49-
is($uri->scheme, "ftps");
50-
51-
is($uri->port, 990);
52-
53-
is($uri->secure, 1);
54-
55-
is($uri->encrypt_mode, 'implicit');
56-
57-
$uri = URI->new("ftpes://ftp.example.com/path");
58-
59-
is($uri->scheme, "ftpes");
60-
61-
is($uri->port, 21);
62-
63-
is($uri->secure, 1);
64-
65-
is($uri->encrypt_mode, 'explicit');

t/ftpes.t

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More tests => 4;
5+
6+
use URI ();
7+
my $uri;
8+
9+
$uri = URI->new("ftpes://ftp.example.com/path");
10+
11+
is($uri->scheme, 'ftpes');
12+
is($uri->port, 21);
13+
is($uri->secure, 1);
14+
is($uri->encrypt_mode, 'explicit');

t/ftps.t

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More tests => 4;
5+
6+
use URI ();
7+
my $uri;
8+
9+
$uri = URI->new("ftps://ftp.example.com/path");
10+
11+
is($uri->scheme, 'ftps');
12+
is($uri->port, 990);
13+
is($uri->secure, 1);
14+
is($uri->encrypt_mode, 'implicit');

t/irc.t

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
use strict;
22
use warnings;
33

4-
use Test::More tests => 12;
4+
use Test::More tests => 10;
55

66
use URI ();
77
my $uri;
88

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

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

1514
# add a password
1615
$uri->password('foobar');
16+
1717
is($uri->userinfo, "PerlUser:foobar");
1818

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

2222
$uri->options(foo => "bar", bar => "baz");
23-
is($uri->query, "foo=bar&bar=baz");
2423

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

2928
# add a bunch of flags to clean up
@@ -37,7 +36,3 @@ is($uri->secure, 0);
3736

3837
$uri->port(undef);
3938
is($uri->port, 6667);
40-
41-
$uri->scheme("ircs");
42-
is($uri->port, 994);
43-
is($uri->secure, 1);

t/ircs.t

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More tests => 4;
5+
6+
use URI ();
7+
my $uri;
8+
9+
$uri = URI->new("ircs://PerlUser\@irc.perl.org");
10+
11+
is($uri, "ircs://PerlUser\@irc.perl.org");
12+
is($uri->scheme, 'ircs');
13+
is($uri->port, 994);
14+
is($uri->secure, 1);

0 commit comments

Comments
 (0)