blob: c266b41ba2a3a2aef726ac318f79fbd8410af564 (
plain)
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
|
# sample.t -- a sample test file for Module::Build
use strict;
use lib 't/lib';
use MBTest;
use DistGen;
plan tests => 4;
# Ensure any Module::Build modules are loaded from correct directory
blib_load('Module::Build');
# enter the directory and generate the skeleton files
my $dist = DistGen->new( name => "Not::So::Simple" )->chdir_in;
#--------------------------------------------------------------------------#
# try getting module_name from dist directory name
#--------------------------------------------------------------------------#
$dist->change_build_pl(
dist_name => 'Random-Name',
dist_version => 1,
)->regen;
my $mb = $dist->new_from_context();
isa_ok( $mb, "Module::Build" );
is( $mb->module_name, "Not::So::Simple",
"module_name guessed from directory name"
);
#--------------------------------------------------------------------------#
# Try getting module_name from dist_version_from
#--------------------------------------------------------------------------#
$dist->add_file( 'lib/Simple/Name.pm', << 'END_PACKAGE' );
package Simple::Name;
our $VERSION = 1.23;
1;
END_PACKAGE
$dist->change_build_pl(
dist_name => 'Random-Name',
dist_version_from => 'lib/Simple/Name.pm',
dist_abstract => "Don't complain about missing abstract",
)->regen( clean => 1 );
$mb = $dist->new_from_context();
isa_ok( $mb, "Module::Build" );
is( $mb->module_name, "Simple::Name",
"module_name guessed from dist_version_from"
);
# vim:ts=2:sw=2:et:sta:sts=2
|