+6.02 Sat Jun 15 19:46:06 EDT 2002
+ - ExtUtils::Installed->modules() was broken in scalar context
+ - Sync bleadperl 16922: Netware updates from Ananth Kesari.
+ - Sync bleadperl 16922: MM_NW5 tests
+ - Sync bleadperl 16938 & 16974: MM_MacOS->macify fixes from pudge.
+ - Sync bleadperl 16989 & 16942: Small test fixes for MacPerl from pudge.
+ - Improved WriteMakefile param verification to differenciate between
+ parameters which don't exist and those that just take strings/numbers.
+ [RT #707]
+ * Documented TEST_VERBOSE
+
6.01 Thu May 30 14:48:57 EDT 2002
- MacOS Classic fixes from Pudge: recursive make repair,
post_initialize() now used, DEFINE & INC work with relative paths,
expand_wildcards();
foreach (@ARGV)
{
- next unless -f $_;
+ next unless -f $_;
next if unlink($_);
- chmod(0777,$_);
+ chmod(0777,$_);
next if unlink($_);
carp "Cannot delete $_:$!";
}
croak("Too many arguments") if (@ARGV > 1 && ! -d $dst);
while (@ARGV)
{
- my $src = shift(@ARGV);
+ my $src = shift(@ARGV);
move($src,$dst);
}
}
Copies source to destination.
Multiple sources are allowed if destination is an existing directory.
-=cut
+=cut
sub cp
{
croak("Too many arguments") if (@ARGV > 1 && ! -d $dst);
while (@ARGV)
{
- my $src = shift(@ARGV);
+ my $src = shift(@ARGV);
copy($src,$dst);
}
}
require VMS::Filespec if $^O eq 'VMS';
use vars qw($VERSION);
-$VERSION = '0.05';
+$VERSION = '0.06';
my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/);
sub modules {
my ($self) = @_;
- return sort keys %$self;
+
+ # Bug/feature of sort in scalar context requires this.
+ return wantarray ? sort keys %$self : keys %$self;
}
sub files {
}
mkdir("Obj", 0777) unless -d "Obj";
-
+
$self = {} unless (defined $self);
my(%initial_att) = %$self; # record initial attributes
use ExtUtils::MakeMaker qw($Verbose neatvalue);
-$VERSION = '1.32';
+$VERSION = '1.33';
require ExtUtils::MM_Any;
@ISA = qw(ExtUtils::MM_Any);
}
# strip blanks
- if ($self->{VERSION}) {
+ if (defined $self->{VERSION}) {
$self->{VERSION} =~ s/^\s+//;
$self->{VERSION} =~ s/\s+$//;
}
+ else {
+ $self->{VERSION} = '';
+ }
($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
$self->{DISTVNAME} = "$self->{DISTNAME}-$self->{VERSION}";
$self->{MAKEFILE}, q[";' \\
-e 'print "Manifying $$m{$$_}\n";' \\
-e 'system(q[$(PERLRUN) $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
--e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
+-e 'chmod(oct($(PERM_RW)), $$m{$$_}) or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
];
push @m, "\nmanifypods : pure_all ";
push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
BEGIN {require 5.005_03;}
-$VERSION = "6.01";
+$VERSION = "6.02";
$Version_OK = "5.49"; # Makefiles older than $Version_OK will die
# (Will be checked from MakeMaker version 4.13 onwards)
-($Revision = substr(q$Revision: 1.59 $, 10)) =~ s/\s+$//;
+($Revision = substr(q$Revision: 1.61 $, 10)) =~ s/\s+$//;
require Exporter;
use Config;
}
-# Basic signatures of the attributes WriteMakefile takes. Each is
-# the reference type. Any not noted simply take strings.
+# Basic signatures of the attributes WriteMakefile takes. Each is the
+# reference type. Empty value indicate it takes a non-reference
+# scalar.
my %Att_Sigs =
(
- C => 'array',
- CONFIG => 'array',
- CONFIGURE => 'code',
- DIR => 'array',
- DL_FUNCS => 'hash',
- DL_VARS => 'array',
- EXCLUDE_EXT=> 'array',
- EXE_FILES => 'array',
- FUNCLIST => 'array',
- H => 'array',
- IMPORTS => 'hash',
- INCLUDE_EXT=> 'array',
- LIBS => ['array','string'],
- MAN1PODS => 'hash',
- MAN3PODS => 'hash',
- PL_FILES => 'hash',
- PM => 'hash',
- PMLIBDIRS => 'array',
- PREREQ_PM => 'hash',
- SKIP => 'array',
- TYPEMAPS => 'array',
- XS => 'hash',
+ ABSTRACT => '',
+ ABSTRACT_FROM => '',
+ AUTHOR => '',
+ BINARY_LOCATION => '',
+ C => 'array',
+ CCFLAGS => '',
+ CONFIG => 'array',
+ CONFIGURE => 'code',
+ DEFINE => '',
+ DIR => 'array',
+ DISTNAME => '',
+ DL_FUNCS => 'hash',
+ DL_VARS => 'array',
+ EXCLUDE_EXT => 'array',
+ EXE_FILES => 'array',
+ FIRST_MAKEFILE => '',
+ FULLPERL => '',
+ FULLPERLRUN => '',
+ FULLPERLRUNINST => '',
+ FUNCLIST => 'array',
+ H => 'array',
+ IMPORTS => 'hash',
+ INC => '',
+ INCLUDE_EXT => 'array',
+ INSTALLARCHLIB => '',
+ INSTALLBIN => '',
+ INSTALLDIRS => '',
+ INSTALLMAN1DIR => '',
+ INSTALLMAN3DIR => '',
+ INSTALLPRIVLIB => '',
+ INSTALLSCRIPT => '',
+ INSTALLSITEARCH => '',
+ INSTALLSITEBIN => '',
+ INSTALLSITELIB => '',
+ INSTALLSITEMAN1DIR => '',
+ INSTALLSITEMAN3DIR => '',
+ INSTALLVENDORARCH => '',
+ INSTALLVENDORBIN => '',
+ INSTALLVENDORLIB => '',
+ INSTALLVENDORMAN1DIR => '',
+ INSTALLVENDORMAN3DIR => '',
+ INST_ARCHLIB => '',
+ INST_BIN => '',
+ INST_LIB => '',
+ INST_MAN1DIR => '',
+ INST_MAN3DIR => '',
+ INST_SCRIPT => '',
+ _KEEP_AFTER_FLUSH => '',
+ LDFROM => '',
+ LIB => '',
+ LIBPERL_A => '',
+ LIBS => ['array',''],
+ LINKTYPE => '',
+ MAKEAPERL => '',
+ MAKEFILE => '',
+ MAN1PODS => 'hash',
+ MAN3PODS => 'hash',
+ MAP_TARGET => '',
+ MYEXTLIB => '',
+ NAME => '',
+ NEEDS_LINKING => '',
+ NOECHO => '',
+ NORECURS => '',
+ NO_VC => '',
+ OBJECT => '',
+ OPTIMIZE => '',
+ PERL => '',
+ PERL_CORE => '',
+ PERLMAINCC => '',
+ PERL_ARCHLIB => '',
+ PERL_LIB => '',
+ PERL_MALLOC_OK => '',
+ PERLRUN => '',
+ PERLRUNINST => '',
+ PERL_SRC => '',
+ PERM_RW => '',
+ PERM_RWX => '',
+ PL_FILES => 'hash',
+ PM => 'hash',
+ PMLIBDIRS => 'array',
+ PM_FILTER => '',
+ POLLUTE => '',
+ PPM_INSTALL_EXEC => '',
+ PPM_INSTALL_SCRIPT => '',
+ PREFIX => '',
+ PREREQ_FATAL => '',
+ PREREQ_PM => 'hash',
+ PREREQ_PRINT => '',
+ PRINT_PREREQ => '',
+ SITEPREFIX => '',
+ SKIP => 'array',
+ TYPEMAPS => 'array',
+ VENDORPREFIX => '',
+ VERBINST => '',
+ VERSION => '',
+ VERSION_FROM => '',
+ XS => 'hash',
+ XSOPT => '',
+ XSPROTOARG => '',
+ XS_VERSION => '',
clean => 'hash',
depend => 'hash',
);
my %Default_Att = (
- string => '',
+ '' => '',
hash => {},
array => [],
- code => sub {}
+ code => sub {},
);
sub _verify_att {
while( my($key, $val) = each %$att ) {
my $sig = $Att_Sigs{$key};
- my @sigs = ref $sig ? @$sig : ($sig || 'string');
- my $given = lc ref $val || 'string';
+ unless( defined $sig ) {
+ warn "WARNING: $key is not a known parameter.\n";
+ next;
+ }
+
+ my @sigs = ref $sig ? @$sig : $sig;
+ my $given = lc ref $val;
unless( grep $given eq $_, @sigs ) {
- my $takes = join " or ", map { $_ ne 'string' ? "$_ reference"
- : "string/number"
+ my $takes = join " or ", map { $_ ne '' ? "$_ reference"
+ : "string/number"
} @sigs;
- my $has = $given ne 'string' ? "$given reference"
- : "string/number";
+ my $has = $given ne '' ? "$given reference"
+ : "string/number";
warn "WARNING: $key takes a $takes not a $has.\n".
" Please inform the author.\n";
$att->{$key} = $Default_Att{$sigs[0]};
=head2 make test
MakeMaker checks for the existence of a file named F<test.pl> in the
-current directory and if it exists it adds commands to the test target
-of the generated Makefile that will execute the script with the proper
-set of perl C<-I> options.
+current directory and if it exists it execute the script with the
+proper set of perl C<-I> options.
MakeMaker also checks for any files matching glob("t/*.t"). It will
-add commands to the test target of the generated Makefile that execute
-all matching files in alphabetical order via the L<Test::Harness>
-module with the C<-I> switches set correctly.
+execute all matching files in alphabetical order via the
+L<Test::Harness> module with the C<-I> switches set correctly.
+
+If you'd like to see the raw output of your tests, set the
+C<TEST_VERBOSE> variable to true.
+
+ make test TEST_VERBOSE=1
=head2 make testdb
test under the Perl debugger (see L<perldebug>). If the file
F<test.pl> exists in the current directory, it is used for the test.
-If you want to debug some other testfile, set C<TEST_FILE> variable
+If you want to debug some other testfile, set the C<TEST_FILE> variable
thusly:
make testdb TEST_FILE=t/mytest.t
By default the debugger is called using C<-d> option to perl. If you
-want to specify some other option, set C<TESTDB_SW> variable:
+want to specify some other option, set the C<TESTDB_SW> variable:
make testdb TESTDB_SW=-Dx
Defaults to $Config{installprefixexp}.
-=item PREREQ_PM
-
-Hashref: Names of modules that need to be available to run this
-extension (e.g. Fcntl for SDBM_File) are the keys of the hash and the
-desired version is the value. If the required version number is 0, we
-only check if any version is installed already.
-
=item PREREQ_FATAL
Bool. If this parameter is true, failing to have the required modules
It is I<extremely> rare to have to use C<PREREQ_FATAL> at all!
+=item PREREQ_PM
+
+Hashref: Names of modules that need to be available to run this
+extension (e.g. Fcntl for SDBM_File) are the keys of the hash and the
+desired version is the value. If the required version number is 0, we
+only check if any version is installed already.
+
=item PREREQ_PRINT
Bool. If this parameter is true, the prerequisites will be printed to
$VERSION = '1.00';
*VERSION = \'1.01';
- ( $VERSION ) = '$Revision: 1.59 $ ' =~ /\$Revision:\s+([^\s]+)/;
+ ( $VERSION ) = '$Revision: 1.61 $ ' =~ /\$Revision:\s+([^\s]+)/;
$FOO::VERSION = '1.10';
*FOO::VERSION = \'1.11';
our $VERSION = 1.2.3; # new for perl5.6.0
use strict;
use Test::More tests => 9;
-use File::Spec::Functions;
-use File::Path;
use File::Basename;
+use File::Path;
+use File::Spec;
my %Files = (
- catfile(curdir(),'Big-Dummy','lib','Big','Dummy.pm') => <<'END',
+ 'Big-Dummy/lib/Big/Dummy.pm' => <<'END',
package Big::Dummy;
$VERSION = 0.01;
1;
END
- catfile(curdir(),'Big-Dummy','Makefile.PL') => <<'END',
+ 'Big-Dummy/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
printf "Current package is: %s\n", __PACKAGE__;
);
END
- catfile(curdir(),'Big-Dummy','t','compile.t') => <<'END',
+ 'Big-Dummy/t/compile.t' => <<'END',
print "1..2\n";
print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
print "ok 2 - TEST_VERBOSE\n";
END
- catfile(curdir(),'Big-Dummy','Liar','t','sanity.t') => <<'END',
+ 'Big-Dummy/Liar/t/sanity.t' => <<'END',
print "1..3\n";
print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
print "ok 3 - TEST_VERBOSE\n";
END
- catfile(curdir(),'Big-Dummy','Liar','lib','Big','Liar.pm') => <<'END',
+ 'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
package Big::Liar;
$VERSION = 0.01;
1;
END
- catfile(curdir(),'Big-Dummy','Liar','Makefile.PL') => <<'END',
+ 'Big-Dummy/Liar/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
my $mm = WriteMakefile(
}
END
- catfile(curdir(),'Problem-Module','Makefile.PL') => <<'END',
+ 'Problem-Module/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
WriteMakefile(
);
END
- catfile(curdir(),'Problem-Module','subdir','Makefile.PL') => <<'END',
+ 'Problem-Module/subdir/Makefile.PL' => <<'END',
printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
warn "I think I'm going to be sick\n";
);
while(my($file, $text) = each %Files) {
+ # Convert to a relative, native file path.
+ $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
+
my $dir = dirname($file);
mkpath $dir;
open(FILE, ">$file");
SKIP: {
if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' ||
$^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin' ||
- $^O eq 'MacOS') {
+ $^O eq 'MacOS'
+ ) {
skip( "different file permission semantics on $^O", 3);
}
use File::Basename;
use File::Spec;
-use Test::More tests => 45;
+use Test::More tests => 46;
BEGIN { use_ok( 'ExtUtils::Installed' ) }
my $wrotelist;
-ok(scalar mkpath('auto/FakeMod'));
+
+rmtree 'auto/FakeMod';
+ok( mkpath('auto/FakeMod') );
END { rmtree 'auto/FakeMod' }
ok(open(PACKLIST, '>auto/FakeMod/.packlist'));
is( join(' ', $ei->modules()), 'abc def ghi',
'modules() should return sorted keys' );
+# This didn't work for a long time due to a sort in scalar context oddity.
+is( $ei->modules, 3, 'modules() in scalar context' );
+
# files
$ei->{goodmod} = {
packlist => {
}
use strict;
-use Test::More tests => 12;
+use Test::More tests => 16;
use TieOut;
use MakeMaker::Test::Utils;
VERSION_FROM => 'lib/Big/Dummy.pm',
AUTHOR => sub {},
);
-
+
is( $warnings, <<VERIFY );
WARNING: AUTHOR takes a string/number not a code reference.
Please inform the author.
VERSION_FROM => 'lib/Big/Dummy.pm',
LIBS => '-lwibble -lwobble',
);
-
+
# We'll get warnings about the bogus libs, that's ok.
unlike( $warnings, qr/WARNING: .* takes/ );
is_deeply( $mm->{LIBS}, ['-lwibble -lwobble'] );
VERSION_FROM => 'lib/Big/Dummy.pm',
LIBS => ['-lwibble', '-lwobble'],
);
-
+
# We'll get warnings about the bogus libs, that's ok.
unlike( $warnings, qr/WARNING: .* takes/ );
is_deeply( $mm->{LIBS}, ['-lwibble', '-lwobble'] );
VERSION_FROM => 'lib/Big/Dummy.pm',
LIBS => { wibble => "wobble" },
);
-
+
# We'll get warnings about the bogus libs, that's ok.
like( $warnings, qr{^WARNING: LIBS takes a array reference or string/number not a hash reference}m );
is_deeply( $mm->{LIBS}, [] );
+
+ $warnings = '';
+ $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ WIBBLE => 'something',
+ wump => { foo => 42 },
+ );
+
+ like( $warnings, qr{^WARNING: WIBBLE is not a known parameter.\n}m );
+ like( $warnings, qr{^WARNING: wump is not a known parameter.\n}m );
+
+ is( $mm->{WIBBLE}, 'something' );
+ is_deeply( $mm->{wump}, { foo => 42 } );
}
# -*- Mode: cperl; cperl-indent-level: 4 -*-
-# $Id: Harness.pm,v 1.33 2002/05/29 23:02:48 schwern Exp $
+# $Id: Harness.pm,v 1.37 2002/06/16 06:55:09 schwern Exp $
package Test::Harness;
use strict;
use vars qw($VERSION $Verbose $Switches $Have_Devel_Corestack $Curtest
- $Columns $verbose $switches $ML
+ $Columns $verbose $switches $ML $Strap
@ISA @EXPORT @EXPORT_OK
);
$Have_Devel_Corestack = 0;
-$VERSION = '2.24';
+$VERSION = '2.25';
$ENV{HARNESS_ACTIVE} = 1;
my $Files_In_Dir = $ENV{HARNESS_FILELEAK_IN_DIR};
-my $Strap = Test::Harness::Straps->new;
+$Strap = Test::Harness::Straps->new;
@ISA = ('Exporter');
@EXPORT = qw(&runtests);
out each individual test which failed along with a summary report and
a how long it all took.
-It returns true if everything was ok, false otherwise.
+It returns true if everything was ok. Otherwise it will die() with
+one of the messages in the DIAGNOSTICS section.
=for _private
This is just _run_all_tests() plus _show_results()
print "$test{ml}ok\n ".join(', ', @msg)."\n";
} elsif ($test{max}) {
print "$test{ml}ok\n";
- } elsif (length $test{skip_all}) {
+ } elsif (defined $test{skip_all} and length $test{skip_all}) {
print "skipped\n all skipped: $test{skip_all}\n";
$tot{skipped}++;
} else {
Revision history for Perl extension Test::Harness
+2.25 Sun Jun 16 03:00:33 EDT 2002
+ - $Strap is now a global to allow Test::Harness::Straps
+ experimentation.
+ - Little spelling nit in a diagnostic.
+ - Chris Richmond noted that the runtests() docs were wrong. It will
+ die, not return false, when any tests fail. This is silly, but
+ historically necessary for 'make test'. Docs corrected.
+ - MacPerl test fixes from Pudge. (mutation of bleadperl@16989)
+ - Undef warning introduced in 2.24 on skipped tests with no reasons
+ fixed.
+ * Test::Harness now depends on File::Spec
+
2.24 Wed May 29 19:02:18 EDT 2002
* Nikola Knezevic found a bug when tests are completely skipped
but no reason is given it was considered a failure.
# -*- Mode: cperl; cperl-indent-level: 4 -*-
-# $Id: Straps.pm,v 1.8 2002/05/29 23:02:48 schwern Exp $
+# $Id: Straps.pm,v 1.11 2002/06/16 06:55:10 schwern Exp $
package Test::Harness::Straps;
use strict;
use vars qw($VERSION);
use Config;
-$VERSION = '0.12';
+$VERSION = '0.13';
use Test::Harness::Assert;
use Test::Harness::Iterator;
# print "ok $num\n";
if( $self->{saw_lone_not} &&
($self->{lone_not_line} == $self->{line} - 1) )
- {
+ {
$result{ok} = 0;
}
$totals->{ok}++ if $pass;
if( $result{number} > 100000 ) {
- warn "Enourmous test number seen [test $result{number}]\n";
+ warn "Enormous test number seen [test $result{number}]\n";
warn "Can't detailize, too big.\n";
}
else {
# When taint mode is on, PERL5LIB is ignored. So we need to put
# all that on the command line as -Is.
- if ($first =~ /^#!.*\bperl.*\s-\w*([Tt]+)/) {
- $s .= join " ", qq[ "-$1"], map {qq["-I$_"]} $self->_filtered_INC;
- } elsif ($^O eq 'MacOS') {
- $s .= join " ", map {qq["-I$_"]} $self->_filtered_INC;
- }
+ $s .= join " ", qq[ "-$1"], map {qq["-I$_"]} $self->_filtered_INC
+ if $first =~ /^#!.*\bperl.*\s-\w*([Tt]+)/;
close(TEST) or print "can't close $file. $!\n";
$self->{_old5lib} = $ENV{PERL5LIB};
return join $Config{path_sep}, $self->_filtered_INC;
-}
+}
=item B<_filtered_INC>
$ENV{PERL5LIB} = $self->{_old5lib};
}
}
-
+
=end _private
}
}
-use File::Spec::Functions;
+use Test::More;
+use File::Spec;
+my $Curdir = File::Spec->curdir;
my $SAMPLE_TESTS = $ENV{PERL_CORE}
- ? catdir(curdir(), 'lib', 'sample-tests')
- : catdir(curdir(), 't', 'sample-tests');
-
-use Test::More;
+ ? File::Spec->catdir($Curdir, 'lib', 'sample-tests')
+ : File::Spec->catdir($Curdir, 't', 'sample-tests');
%samples = (
bailout => [qw( header test test test bailout )],
my($self, $line, $type, $totals) = @_;
push @out, $type;
};
-
-$SAMPLE_TESTS = VMS::Filespec::unixify($SAMPLE_TESTS) if $^O eq 'VMS';
while( my($test, $expect) = each %samples ) {
local @out = ();
-
- $strap->analyze_file($^O eq 'MacOS' ?
- catfile($SAMPLE_TESTS, $test) :
- "$SAMPLE_TESTS/$test");
+ $strap->analyze_file(File::Spec->catfile($SAMPLE_TESTS, $test));
is_deeply(\@out, $expect, "$test callback");
}
}
}
-use File::Spec::Functions;
-
-my $SAMPLE_TESTS = $ENV{PERL_CORE}
- ? catdir(curdir(), 'lib', 'sample-tests')
- : catdir(curdir(), 't', 'sample-tests');
-
use strict;
use Test::More;
+use File::Spec;
+
+my $Curdir = File::Spec->curdir;
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? File::Spec->catdir($Curdir, 'lib', 'sample-tests')
+ : File::Spec->catdir($Curdir, 't', 'sample-tests');
-if ($^O eq 'MacOS') {
- plan skip_all => "Exit status broken on Mac OS";
-}
-my $IsVMS = $^O eq 'VMS';
+my $IsMacPerl = $^O eq 'MacOS';
+my $IsVMS = $^O eq 'VMS';
# VMS uses native, not POSIX, exit codes.
my $die_exit = $IsVMS ? 44 : 1;
},
);
-plan tests => (keys(%samples) * 3) + 3;
+plan tests => (keys(%samples) * 4) + 3;
use_ok('Test::Harness::Straps');
$SIG{__WARN__} = sub {
- warn @_ unless $_[0] =~ /^Enourmous test number/ ||
+ warn @_ unless $_[0] =~ /^Enormous test number/ ||
$_[0] =~ /^Can't detailize/
};
-
-$SAMPLE_TESTS = VMS::Filespec::unixify($SAMPLE_TESTS) if $^O eq 'VMS';
-
while( my($test, $expect) = each %samples ) {
for (0..$#{$expect->{details}}) {
$expect->{details}[$_]{type} = ''
unless exists $expect->{details}[$_]{reason};
}
+ my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
my $strap = Test::Harness::Straps->new;
- my %results = $strap->analyze_file($^O eq 'MacOS' ?
- catfile($SAMPLE_TESTS, $test) :
- "$SAMPLE_TESTS/$test");
+ my %results = $strap->analyze_file($test_path);
is_deeply($results{details}, $expect->{details}, "$test details" );
delete $expect->{details};
delete $results{details};
- # We can only check if it's zero or non-zero.
- is( !!$results{'wait'}, !!$expect->{'wait'}, 'wait status' );
- delete $results{'wait'};
- delete $expect->{'wait'};
+ SKIP: {
+ skip '$? unreliable in MacPerl', 2 if $IsMacPerl;
+
+ # We can only check if it's zero or non-zero.
+ is( !!$results{'wait'}, !!$expect->{'wait'}, 'wait status' );
+ delete $results{'wait'};
+ delete $expect->{'wait'};
+
+ # Have to check the exit status seperately so we can skip it
+ # in MacPerl.
+ is( $results{'exit'}, $expect->{'exit'} );
+ delete $results{'exit'};
+ delete $expect->{'exit'};
+ }
is_deeply(\%results, $expect, " the rest $test" );
}
}
}
-use File::Spec::Functions;
+use strict;
+use File::Spec;
+my $Curdir = File::Spec->curdir;
my $SAMPLE_TESTS = $ENV{PERL_CORE}
- ? catdir(curdir(), 'lib', 'sample-tests')
- : catdir(curdir(), 't', 'sample-tests');
+ ? File::Spec->catdir($Curdir, 'lib', 'sample-tests')
+ : File::Spec->catdir($Curdir, 't', 'sample-tests');
-use strict;
# For shutting up Test::Harness.
# Has to work on 5.004 which doesn't have Tie::StdHandle.
use Test::More;
-my $IsVMS = $^O eq 'VMS';
-my $IsMacOS = $^O eq 'MacOS';
+my $IsMacPerl = $^O eq 'MacOS';
+my $IsVMS = $^O eq 'VMS';
# VMS uses native, not POSIX, exit codes.
-my $die_estat = $IsVMS ? 44 : $IsMacOS ? 0 : 1;
+my $die_estat = $IsVMS ? 44 : 1;
my %samples = (
simple => {
},
);
-plan tests => (keys(%samples) * 7) + 1;
+plan tests => (keys(%samples) * 8) + 1;
use Test::Harness;
use_ok('Test::Harness');
tie *NULL, 'My::Dev::Null' or die $!;
-$SAMPLE_TESTS = VMS::Filespec::unixify($SAMPLE_TESTS) if $^O eq 'VMS';
-
while (my($test, $expect) = each %samples) {
# _run_all_tests() runs the tests but skips the formatting.
my($totals, $failed);
- my $warning;
+ my $warning = '';
+ my $test_path = File::Spec->catfile($SAMPLE_TESTS, $test);
+
eval {
select NULL; # _run_all_tests() isn't as quiet as it should be.
local $SIG{__WARN__} = sub { $warning .= join '', @_; };
($totals, $failed) =
- Test::Harness::_run_all_tests($^O eq 'MacOS' ?
- catfile($SAMPLE_TESTS, $test) :
- "$SAMPLE_TESTS/$test");
+ Test::Harness::_run_all_tests($test_path);
};
select STDOUT;
+ # $? is unreliable in MacPerl, so we'll simply fudge it.
+ $failed->{estat} = $die_estat if $IsMacPerl and $failed;
+
SKIP: {
skip "special tests for bailout", 1 unless $test eq 'bailout';
like( $@, '/Further testing stopped: GERONI/i' );
is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
$expect->{total},
"$test - totals" );
- is_deeply( {map { $_=>$failed->{$^O eq 'MacOS' ?
- catfile($SAMPLE_TESTS, $test) :
- "$SAMPLE_TESTS/$test"}{$_} }
+ is_deeply( {map { $_=>$failed->{$test_path}{$_} }
keys %{$expect->{failed}}},
$expect->{failed},
"$test - failed" );
SKIP: {
skip "special tests for bignum", 1 unless $test eq 'bignum';
is( $warning, <<WARN );
-Enourmous test number seen [test 100001]
+Enormous test number seen [test 100001]
Can't detailize, too big.
-Enourmous test number seen [test 136211425]
+Enormous test number seen [test 136211425]
Can't detailize, too big.
WARN
}
+ SKIP: {
+ skip "bignum has known warnings", 1 if $test eq 'bignum';
+ is( $warning, '' );
+ }
}
make make_run make_macro calibrate_mtime
);
-my $Is_VMS = $^O eq 'VMS';
+my $Is_VMS = $^O eq 'VMS';
my $Is_MacOS = $^O eq 'MacOS';