[Module-build-checkins] Module-Build/t ppm.t,1.2,1.3
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <si...@us...> - 2005-12-01 09:00:45
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21714/t Modified Files: ppm.t Log Message: Skip tests when compiler not configured or present. Index: ppm.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/ppm.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ppm.t 22 Nov 2005 11:07:23 -0000 1.2 +++ ppm.t 1 Dec 2005 09:00:37 -0000 1.3 @@ -5,18 +5,35 @@ use Test::More; -unless ( eval {require Archive::Tar} ) { - plan skip_all => "Archive::Tar not installed; can't test archives."; -} else { - plan tests => 12; -} - - use File::Spec (); my $common_pl = File::Spec->catfile( 't', 'common.pl' ); require $common_pl; + +use Module::Build; + +{ # Copied mostly verbatim from t/xs.t; should probably cache in t/common.pl + local $SIG{__WARN__} = sub {}; + + my $mb = Module::Build->current; + $mb->verbose( 0 ); + + my $have_c_compiler; + stderr_of( sub {$have_c_compiler = $mb->have_c_compiler} ); + + if ( ! $mb->feature('C_support') ) { + plan skip_all => 'C_support not enabled'; + } elsif ( !$have_c_compiler ) { + plan skip_all => 'C_support enabled, but no compiler found'; + } elsif ( eval {require Archive::Tar} ) { + plan skip_all => "Archive::Tar not installed; can't test archives."; + } else { + plan tests => 12; + } +} + + use Cwd (); my $cwd = Cwd::cwd; my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' ); @@ -42,7 +59,6 @@ =cut --- $dist->change_file( 'Build.PL', <<"---" ); -use Module::Build; my \$build = new Module::Build( module_name => @{[$dist->name]}, |