File: ftp.t

package info (click to toggle)
liburi-perl 1.35.dfsg.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 540 kB
  • ctags: 258
  • sloc: perl: 4,293; makefile: 51
file content (53 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (5)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!perl -w

print "1..13\n";

use strict;
use URI;
my $uri;

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

print "not " unless $uri->scheme eq "ftp";
print "ok 1\n";

print "not " unless $uri->host eq "ftp.example.com";
print "ok 2\n";

print "not " unless $uri->port eq 21;
print "ok 3\n";

print "not " unless $uri->user eq "anonymous";
print "ok 4\n";

print "not " unless $uri->password eq 'anonymous@';
print "ok 5\n";

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

print "not " unless $uri eq "ftp://gisle%40aas.no\@ftp.example.com/path";
print "ok 6\n";

print "not " unless $uri->user eq "gisle\@aas.no";
print "ok 7\n";

print "not " if defined($uri->password);
print "ok 8\n";

$uri->password("secret");

print "not " unless $uri eq "ftp://gisle%40aas.no:secret\@ftp.example.com/path";
print "ok 9\n";

$uri = URI->new("ftp://gisle\@aas.no:secret\@ftp.example.com/path");
print "not " unless $uri eq "ftp://gisle\@aas.no:secret\@ftp.example.com/path";
print "ok 10\n";

print "not " unless $uri->userinfo eq "gisle\@aas.no:secret";
print "ok 11\n";

print "not " unless $uri->user eq "gisle\@aas.no";
print "ok 12\n";

print "not " unless $uri->password eq "secret";
print "ok 13\n";