summaryrefslogtreecommitdiff
path: root/t/mirror.t
diff options
context:
space:
mode:
Diffstat (limited to 't/mirror.t')
-rw-r--r--t/mirror.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/mirror.t b/t/mirror.t
new file mode 100644
index 0000000..0aa3a54
--- /dev/null
+++ b/t/mirror.t
@@ -0,0 +1,38 @@
+use strict;
+use Module::CPANfile;
+use Test::More;
+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;