'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
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
}
}
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/, $!";
# 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);
}
}
}
- 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 $_;
+ }
}
#####################################################################
}
}
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/, $!";
#########################
-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
}
}
}
- 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 $_;
+ }
+}
+