File: mirror.t

package info (click to toggle)
libmodule-cpanfile-perl 1.1004-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 196 kB
  • sloc: perl: 531; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 830 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
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use Module::CPANfile;
use Test::More;
use lib ".";
use t::Utils;

{
    my $r = write_cpanfile(<<FILE);
mirror 'http://www.cpan.org';
mirror 'http://backpan.cpan.org';

requires 'DBI';
requires 'Plack', '0.9970';

on 'test' => sub {
    requires 'Test::More';
};
FILE

    my $file = Module::CPANfile->load;

    my $prereq = $file->prereq;
    is_deeply $prereq->as_string_hash, {
        test => {
            requires => { 'Test::More' => 0  },
        },
        runtime => {
            requires => { 'Plack' => '0.9970', 'DBI' => 0 },
        },
    };

    my $mirrors = $file->mirrors;
    is_deeply $mirrors, [ 'http://www.cpan.org', 'http://backpan.cpan.org' ];

    like $file->to_string, qr{mirror 'http://www.cpan.org';};
    like $file->to_string, qr{mirror 'http://backpan.cpan.org';};
}

done_testing;