File: uri-cpan.t

package info (click to toggle)
liburi-cpan-perl 1.009-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 251; makefile: 10
file content (41 lines) | stat: -rw-r--r-- 1,379 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;
use Test::More tests => 15;
use URI;
use URI::cpan;

{
  my $url = URI->new('cpan:///distfile/RJBS/URI-cpan-1.00.tar.gz');

  isa_ok($url, 'URI::cpan::distfile', 'distfile with ver');
  is($url->author,       'RJBS',     "we can extract author");
  is($url->dist_name,    'URI-cpan', "we can extract dist_name");
  is($url->dist_version, '1.00',     "we can extract dist_version");
  is($url->dist_filepath, 'RJBS/URI-cpan-1.00.tar.gz',
                          "we can extract dist_filepath");
}

{
  my $url = URI->new('cpan:///distfile/RJBS/deep/path/URI-cpan-1.00.tar.gz');

  isa_ok($url, 'URI::cpan::distfile', 'distfile with path and ver');
  is($url->author,       'RJBS',     "we can extract author");
  is($url->dist_name,    'URI-cpan', "we can extract dist_name");
  is($url->dist_version, '1.00',     "we can extract dist_version");
}

{
  my $url = URI->new('cpan:///distfile/RJBS/URI-cpan-undef.tar.gz');

  isa_ok($url, 'URI::cpan::distfile', 'distfile with undef ver');
  is($url->author,       'RJBS',     "we can extract author");
  is($url->dist_name,    'URI-cpan', "we can extract dist_name");
  is($url->dist_version, undef,      "we can extract dist_version");
}

{
  my $url = URI->new("cpan:///author/RJBS");

  isa_ok($url, 'URI::cpan::author', 'author url');
  is($url->author,       'RJBS',     "we can extract author");
}