File: merge.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 (66 lines) | stat: -rw-r--r-- 1,661 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use strict;
use Module::CPANfile;
use Test::More;
use lib ".";
use t::Utils;

{
    my $r = write_files(cpanfile => <<CPANFILE, 'META.json' => <<META);
requires 'Plack', '0.9970';

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

on 'develop' => sub {
    requires 'Catalyst::Runtime', '> 5.8000, < 5.9';
};
CPANFILE
{
   "abstract" : "A format for describing CPAN dependencies of Perl applications",
   "author" : [
      "Tatsuhiko Miyagawa"
   ],
   "dynamic_config" : 0,
   "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921",
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : "2"
   },
   "name" : "Module-CPANfile",
   "prereqs" : {
      "build" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "6.31"
         }
      },
      "runtime" : {
         "requires" : {
            "perl" : "5.008001",
            "Plack" : "0.9000"
         }
      }
   },
   "version" : "0.9007"
}
META

    my $file = Module::CPANfile->load;
    $file->merge_meta('META.json');

    my $meta = CPAN::Meta->load_file('META.json');
    is_deeply $meta->prereqs, {
        build => { requires => { 'ExtUtils::MakeMaker' => 0 } },
        configure => { requires => { 'ExtUtils::MakeMaker' => '6.31' } },
        runtime => { requires => { 'perl' => '5.008001', 'Plack' => '0.9970' } },
        develop => { requires => { 'Catalyst::Runtime' => '> 5.8000, < 5.9' } },
        test => { requires => { 'Test::More' => '0.90' } },
    };
}

done_testing;