This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module-Build to CPAN version 0.4200
[perl5.git] / cpan / Module-Build / t / properties / requires.t
CommitLineData
0bb35765
DG
1# sample.t -- a sample test file for Module::Build
2
3use strict;
4use lib 't/lib';
5use MBTest;
6use DistGen;
7
8plan tests => 4;
9
10# Ensure any Module::Build modules are loaded from correct directory
11blib_load('Module::Build');
12
13my ($dist, $mb, $prereqs);
14
15#--------------------------------------------------------------------------#
16# try undefined prereq version
17#--------------------------------------------------------------------------#
18
19$dist = DistGen->new( name => 'Simple::Requires' );
20
21$dist->change_build_pl(
22 module_name => 'Simple::Requires',
23 requires => {
24 'File::Basename' => undef,
25 },
26)->regen;
27
28$dist->chdir_in;
29
30$mb = $dist->new_from_context();
31isa_ok( $mb, "Module::Build" );
32
33$prereqs = $mb->_normalize_prereqs;
18b2aa6a 34is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "undef prereq converted to 0");
0bb35765
DG
35
36#--------------------------------------------------------------------------#
37# try empty string prereq version
38#--------------------------------------------------------------------------#
39
40$dist->change_build_pl(
41 module_name => 'Simple::Requires',
42 requires => {
43 'File::Basename' => '',
44 },
45)->regen;
46
47$mb = $dist->new_from_context();
48isa_ok( $mb, "Module::Build" );
49
50$prereqs = $mb->_normalize_prereqs;
18b2aa6a 51is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "empty string prereq converted to 0");
0bb35765
DG
52
53
54# vim:ts=2:sw=2:et:sta:sts=2