Updated Module::Build to 0.35_14
[p5sagit/p5-mst-13.2.git] / cpan / Module-Build / t / properties / module_name.t
CommitLineData
613f422f 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
53fc1c7e 13my $dist;
613f422f 14
15#--------------------------------------------------------------------------#
53fc1c7e 16# try getting module_name from dist_name
613f422f 17#--------------------------------------------------------------------------#
18
53fc1c7e 19$dist = DistGen->new(
20 name => "Not::So::Simple",
21 distdir => 'Random-Name',
22)->chdir_in;
23
613f422f 24$dist->change_build_pl(
53fc1c7e 25 dist_name => 'Not-So-Simple',
613f422f 26 dist_version => 1,
27)->regen;
28
29my $mb = $dist->new_from_context();
30isa_ok( $mb, "Module::Build" );
31is( $mb->module_name, "Not::So::Simple",
53fc1c7e 32 "module_name guessed from dist_name"
613f422f 33);
34
35#--------------------------------------------------------------------------#
36# Try getting module_name from dist_version_from
37#--------------------------------------------------------------------------#
38
39$dist->add_file( 'lib/Simple/Name.pm', << 'END_PACKAGE' );
40package Simple::Name;
41our $VERSION = 1.23;
421;
43END_PACKAGE
44
45$dist->change_build_pl(
46 dist_name => 'Random-Name',
47 dist_version_from => 'lib/Simple/Name.pm',
48 dist_abstract => "Don't complain about missing abstract",
49)->regen( clean => 1 );
50
51$mb = $dist->new_from_context();
52isa_ok( $mb, "Module::Build" );
53is( $mb->module_name, "Simple::Name",
54 "module_name guessed from dist_version_from"
55);
56
57# vim:ts=2:sw=2:et:sta:sts=2