File: 25_perl_version_from.t

package info (click to toggle)
libmodule-install-perl 1.21-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 636 kB
  • sloc: perl: 3,569; makefile: 13
file content (53 lines) | stat: -rw-r--r-- 1,158 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
42
43
44
45
46
47
48
49
50
51
52
53
use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use Test::More;
use File::Spec;
use lib 't/lib';
use MyTest;
use Parse::CPAN::Meta;

plan tests => 36;

my @statements = (
	'use 5.005',
	'use v5.5.0',
	'require 5.005',
	'require v5.5.0',
);
for my $statement (@statements) {
SCOPE: {
	ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' );
use inc::Module::Install 0.81;
name     'Foo';
version  '0.01';
license  'perl';
perl_version_from 'lib/Foo.pm';
WriteAll;
END_DSL

	ok( add_file('lib/Foo.pm', <<"END_PM") );
package Foo;
use strict;
$statement;
1;
END_PM

	ok( build_dist(), 'build_dist' );
	my $file = makefile();
	ok( -f $file, 'Makefile exists' );
	my $content = _read($file);
	ok($content, 'file is not empty');
SKIP: {
    skip 'requires ExtUtils::MakeMaker > 6.48', 1 if eval($ExtUtils::MakeMaker::VERSION) < 6.48;
	ok($content =~ /#\s*MIN_PERL_VERSION => q\[5\.005\]/, 'has perl_version');
}
	my $meta = file('META.yml');
	ok( -f $meta, 'META.yml exists' );
	my $yaml = Parse::CPAN::Meta::LoadFile($meta);
	is( $yaml->{requires}->{perl}, '5.005', 'META has correct perl version requirement' );
	ok( kill_dist(), 'kill_dist' );
}}