Update ExtUtils::ParseXS to 2.19_04
authorDavid Golden <dagolden@cpan.org>
Mon, 29 Jun 2009 16:13:31 +0000 (12:13 -0400)
committerH.Merijn Brand <h.m.brand@xs4all.nl>
Mon, 29 Jun 2009 16:33:12 +0000 (18:33 +0200)
2.19_04 - Mon Jun 29 11:49:12 EDT 2009

 - Changed tests to use Test::More and added it to prereqs

 - Some tests skip if no compiler or if no dynamic loading

 - INTERFACE keyword tests skipped for perl < 5.8

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Porting/Maintainers.pl
lib/ExtUtils/ParseXS.pm
lib/ExtUtils/ParseXS/t/basic.t
lib/ExtUtils/ParseXS/t/usage.t

index ff414f2..0175b66 100755 (executable)
@@ -733,7 +733,7 @@ package Maintainers;
     'ExtUtils::ParseXS' =>
        {
        'MAINTAINER'    => 'kwilliams',
-       'DISTRIBUTION'  => 'DAGOLDEN/ExtUtils-ParseXS-2.19_03.tar.gz',
+       'DISTRIBUTION'  => 'DAGOLDEN/ExtUtils-ParseXS-2.19_04.tar.gz',
        'FILES'         => q[lib/ExtUtils/ParseXS.pm
                             lib/ExtUtils/ParseXS
                             lib/ExtUtils/xsubpp
index bf567aa..6dbaecf 100644 (file)
@@ -18,7 +18,7 @@ my(@XSStack); # Stack of conditionals and INCLUDEs
 my($XSS_work_idx, $cpp_next_tmp);
 
 use vars qw($VERSION);
-$VERSION = '2.19_03';
+$VERSION = '2.19_04';
 
 use vars qw(%input_expr %output_expr $ProtoUsed @InitFileCode $FH $proto_re $Overload $errors $Fallback
            $cplusplus $hiertype $WantPrototypes $WantVersionChk $except $WantLineNumbers
index f772596..241ab19 100644 (file)
@@ -9,12 +9,17 @@ BEGIN {
   }
 }
 use strict;
-use Test;
-BEGIN { plan tests => 10 };
+use Test::More;
+use Config;
 use DynaLoader;
-use ExtUtils::ParseXS qw(process_file);
 use ExtUtils::CBuilder;
-ok(1); # If we made it this far, we're loaded.
+
+plan tests => 10;
+
+my ($source_file, $obj_file, $lib_file);
+
+require_ok( 'ExtUtils::ParseXS' );
+ExtUtils::ParseXS->import('process_file');
 
 chdir 't' or die "Can't chdir to t/, $!";
 
@@ -25,32 +30,35 @@ use Carp; $SIG{__WARN__} = \&Carp::cluck;
 # Try sending to filehandle
 tie *FH, 'Foo';
 process_file( filename => 'XSTest.xs', output => \*FH, prototypes => 1 );
-ok tied(*FH)->content, '/is_even/', "Test that output contains some text";
+like tied(*FH)->content, '/is_even/', "Test that output contains some text";
 
-my $source_file = 'XSTest.c';
+$source_file = 'XSTest.c';
 
 # Try sending to file
 process_file(filename => 'XSTest.xs', output => $source_file, prototypes => 0);
-ok -e $source_file, 1, "Create an output file";
+ok -e $source_file, "Create an output file";
 
-# TEST doesn't like extraneous output
 my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
-
-# Try to compile the file!  Don't get too fancy, though.
 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
-if ($b->have_compiler) {
-  my $module = 'XSTest';
 
-  my $obj_file = $b->compile( source => $source_file );
+SKIP: {
+  skip "no compiler available", 2
+    if ! $b->have_compiler;
+  $obj_file = $b->compile( source => $source_file );
   ok $obj_file;
-  ok -e $obj_file, 1, "Make sure $obj_file exists";
+  ok -e $obj_file, "Make sure $obj_file exists";
+}
 
-  my $lib_file = $b->link( objects => $obj_file, module_name => $module );
+SKIP: {
+  skip "no dynamic loading", 5
+    if !$b->have_compiler || !$Config{usedl};
+  my $module = 'XSTest';
+  $lib_file = $b->link( objects => $obj_file, module_name => $module );
   ok $lib_file;
-  ok -e $lib_file, 1, "Make sure $lib_file exists";
+  ok -e $lib_file,  "Make sure $lib_file exists";
 
   eval {require XSTest};
-  ok $@, '';
+  is $@, '';
   ok  XSTest::is_even(8);
   ok !XSTest::is_even(9);
 
@@ -64,16 +72,13 @@ if ($b->have_compiler) {
       }
     }
   }
-  unless ($ENV{PERL_NO_CLEANUP}) {
-    1 while unlink $obj_file;
-    1 while unlink $lib_file;
-  }
-} else {
-  skip "Skipped can't find a C compiler & linker", 1 for 1..7;
 }
 
 unless ($ENV{PERL_NO_CLEANUP}) {
-  1 while unlink $source_file;
+  for ( $obj_file, $lib_file, $source_file) {
+    next unless defined $_;
+    1 while unlink $_;
+  }
 }
 
 #####################################################################
index 2d3bdc9..39a6e41 100644 (file)
@@ -9,12 +9,22 @@ BEGIN {
   }
 }
 use strict;
-use Test;
-BEGIN { plan tests => 24 };
+use Test::More;
+use Config;
 use DynaLoader;
-use ExtUtils::ParseXS qw(process_file);
 use ExtUtils::CBuilder;
-ok(1); # If we made it this far, we're loaded.
+
+if ( $] < 5.008 ) {
+  plan skip_all => "INTERFACE keyword support broken before 5.8";
+}
+else {
+  plan tests => 24;
+}
+
+my ($source_file, $obj_file, $lib_file, $module);
+
+require_ok( 'ExtUtils::ParseXS' );
+ExtUtils::ParseXS->import('process_file');
 
 chdir 't' or die "Can't chdir to t/, $!";
 
@@ -22,30 +32,37 @@ use Carp; $SIG{__WARN__} = \&Carp::cluck;
 
 #########################
 
-my $source_file = 'XSUsage.c';
+$source_file = 'XSUsage.c';
 
 # Try sending to file
 process_file(filename => 'XSUsage.xs', output => $source_file);
-ok -e $source_file, 1, "Create an output file";
+ok -e $source_file, "Create an output file";
 
 # TEST doesn't like extraneous output
 my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
 
 # Try to compile the file!  Don't get too fancy, though.
 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
-if ($b->have_compiler) {
-  my $module = 'XSUsage';
 
-  my $obj_file = $b->compile( source => $source_file );
+SKIP: {
+  skip "no compiler available", 2
+    if ! $b->have_compiler;
+  $module = 'XSUsage';
+
+  $obj_file = $b->compile( source => $source_file );
   ok $obj_file;
-  ok -e $obj_file, 1, "Make sure $obj_file exists";
+  ok -e $obj_file, "Make sure $obj_file exists";
+}
+SKIP: {
+  skip "no dynamic loading", 20 
+    if !$b->have_compiler || !$Config{usedl};
 
-  my $lib_file = $b->link( objects => $obj_file, module_name => $module );
+  $lib_file = $b->link( objects => $obj_file, module_name => $module );
   ok $lib_file;
-  ok -e $lib_file, 1, "Make sure $lib_file exists";
+  ok -e $lib_file, "Make sure $lib_file exists";
 
   eval {require XSUsage};
-  ok $@, '';
+  is $@, '';
 
   # The real tests here - for each way of calling the functions, call with the
   # wrong number of arguments and check the Usage line is what we expect
@@ -97,10 +114,12 @@ if ($b->have_compiler) {
       }
     }
   }
-  1 while unlink $obj_file;
-  1 while unlink $lib_file;
-} else {
-  skip "Skipped can't find a C compiler & linker", 1 for 3 .. 24;
 }
 
-1 while unlink $source_file;
+unless ($ENV{PERL_NO_CLEANUP}) {
+  for ( $obj_file, $lib_file, $source_file) {
+    next unless defined $_;
+    1 while unlink $_;
+  }
+}
+