This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert #32197, should not be needed anymore since the upgrade
[perl5.git] / lib / Module / Build / t / xs.t
index 78ca6d9..25e1759 100644 (file)
@@ -22,7 +22,7 @@ use Module::Build;
 
 use Cwd ();
 my $cwd = Cwd::cwd;
-my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' );
+my $tmp = MBTest->tmpdir;
 
 use DistGen;
 my $dist = DistGen->new( dir => $tmp, xs => 1 );
@@ -65,10 +65,12 @@ is $@, '';
   eval {$mb->dispatch('clean')};
   is $@, '';
 
+
   $mb->create_build_script;
-  ok -e 'Build';
+  my $script = $mb->build_script;
+  ok -e $script;
 
-  eval {$mb->run_perl_script('Build')};
+  eval {$mb->run_perl_script($script)};
   is $@, '';
 }
 
@@ -83,11 +85,12 @@ is $@, '';
 
 SKIP: {
   skip( "skipping a Unixish-only tests", 1 )
-      unless $mb->os_type eq 'Unix';
+      unless $mb->is_unixish;
 
-  local $mb->{config}{ld} = "FOO=BAR $mb->{config}{ld}";
+  $mb->{config}->push(ld => "FOO=BAR ".$mb->config('ld'));
   eval {$mb->dispatch('build')};
   is $@, '';
+  $mb->{config}->pop('ld');
 }
 
 eval {$mb->dispatch('realclean')};
@@ -106,7 +109,7 @@ $dist->remove;
 
 # Try a XS distro with a deep namespace
 
-$dist = DistGen->new( name => 'Simple::With::Deep::Namespace',
+$dist = DistGen->new( name => 'Simple::With::Deep::Name',
                      dir => $tmp, xs => 1 );
 $dist->regen;
 chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
@@ -138,19 +141,14 @@ $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->change_build_pl
+  ({
     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"