[Module-build-checkins] Module-Build/t xs.t,1.33,1.34
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <si...@us...> - 2005-11-27 09:32:58
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24026/t Modified Files: xs.t Log Message: Add tests for a distro with a flat directory structure and that does not define the "module_name" property (i.e. it uses "dist_name"). Index: xs.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/xs.t,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- xs.t 21 Nov 2005 06:24:58 -0000 1.33 +++ xs.t 27 Nov 2005 09:32:50 -0000 1.34 @@ -26,7 +26,7 @@ } elsif ( !$have_c_compiler ) { plan skip_all => 'C_support enabled, but no compiler found'; } else { - plan tests => 14; + plan tests => 22; } } @@ -90,14 +90,14 @@ eval {$mb->dispatch('test')}; is $@, ''; +eval {$mb->dispatch('clean')}; +is $@, ''; + SKIP: { - skip( "skipping a couple Unixish-only tests", 2 ) + skip( "skipping a Unixish-only tests", 1 ) unless $mb->os_type eq 'Unix'; - eval {$mb->dispatch('clean')}; - is $@, ''; - local $mb->{config}{ld} = "FOO=BAR $mb->{config}{ld}"; eval {$mb->dispatch('build')}; is $@, ''; @@ -114,5 +114,129 @@ chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; $dist->remove; + +######################################## + +# Try a XS distro with a deep namespace + +$dist = DistGen->new( name => 'Simple::With::Deep::Namespace', + dir => $tmp, xs => 1 ); +$dist->regen; +chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; + +$mb = Module::Build->new_from_context; +is $@, ''; + +$mb->dispatch('build'); +is $@, ''; + +$mb->dispatch('test'); +is $@, ''; + +$mb->dispatch('realclean'); +is $@, ''; + +# cleanup +chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; +$dist->remove; + + +######################################## + +# Try a XS distro using a flat directory structure +# and a 'dist_name' instead of a 'module_name' + +$dist = DistGen->new( name => 'Dist-Name', dir => $tmp, xs => 1 ); + +$dist->remove_file('lib/Dist-Name.pm'); +$dist->remove_file('lib/Dist-Name.xs'); + +$dist->change_file('Build.PL', <<"---"); +use strict; +use Module::Build; + +my \$builder = Module::Build->new( + dist_name => 'Dist-Name', + dist_version_from => 'Simple.pm', + pm_files => { 'Simple.pm' => 'lib/Simple.pm' }, + xs_files => { 'Simple.xs' => 'lib/Simple.xs' }, +); + +\$builder->create_build_script(); +--- +$dist->add_file('Simple.xs', <<"---"); +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +MODULE = Simple PACKAGE = Simple + +SV * +ok() + CODE: + RETVAL = newSVpv( "ok", 0 ); + OUTPUT: + RETVAL +--- + +$dist->add_file( 'Simple.pm', <<"---" ); +package Simple; + +use base qw( Exporter DynaLoader ); + +use vars qw( \$VERSION \@EXPORT_OK ); +\$VERSION = '0.01'; +\@EXPORT_OK = qw( ok ); + +bootstrap Simple \$VERSION; + +1; + +__END__ + +=head1 NAME + +Simple - Perl extension for blah blah blah + +=head1 DESCRIPTION + +Stub documentation for Simple. + +=head1 AUTHOR + +A. U. Thor, a.u.thor\@a.galaxy.far.far.away + +=cut +--- +$dist->change_file('t/basic.t', <<"---"); +use Test::More tests => 2; +use strict; + +use Simple; +ok( 1 ); + +ok( Simple::ok() eq 'ok' ); +--- + +$dist->regen; +chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; + + +$mb = Module::Build->new_from_context; +is $@, ''; + +$mb->dispatch('build'); +is $@, ''; + +$mb->dispatch('test'); +is $@, ''; + +$mb->dispatch('realclean'); +is $@, ''; + +# cleanup +chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; +$dist->remove; + use File::Path; rmtree( $tmp ); |