Permalink
Browse files

Merge branch 'release/v0.41'

  • Loading branch information...
2 parents 6207a4b + f7b9adb commit 039ce0a3953c4baea27c914be318ad7594373d27 Philip Garrett committed Mar 4, 2012
View
@@ -1,5 +1,9 @@
Revision history for Perl extension Test::Spec.
+0.41 Sat Mar 03 19:04:00 EST 2012
+ - Added license info to Makefile.PL (RT #75400)
+ - Fixed test suite problems on Windows
+
0.40 Mon Jan 30 18:38:00 EST 2012
- Fixed problem that caused Test::Spec usage errors (e.g. 'describe "foo";'
without a subroutine argument) to be reported from inside the library,
View
@@ -21,4 +21,5 @@ WriteMakefile(
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Test/Spec.pm', # retrieve abstract from module
AUTHOR => 'Philip Garrett <philip.garrett@icainformatics.com>') : ()),
+ LICENSE => 'perl',
);
View
@@ -3,7 +3,7 @@ use strict;
use warnings;
use Test::Trap (); # load as early as possible to override CORE::exit
-our $VERSION = '0.40';
+our $VERSION = '0.41';
use base qw(Exporter);
@@ -11,6 +11,8 @@
#
package Testcase::Spec::AnotherSharedExamplesSpec;
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
spec_helper 'shared_examples_spec.pl';
View
@@ -9,6 +9,8 @@
package Testcase::Spec::Disabled;
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
describe 'Test::Spec' => sub {
xdescribe 'disabled spec' => sub {
View
@@ -9,6 +9,8 @@
#
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
describe "Test::Spec" => sub {
it "should trap die message" => sub {
View
@@ -8,6 +8,8 @@
########################################################################
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
describe "Test::Spec" => sub {
it "turns on perl warnings in test file" => sub {
@@ -9,6 +9,8 @@
#
package Testcase::Spec::SharedExamplesSpec;
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
shared_examples_for "example group" => sub {
it "can take at least one example";
@@ -7,6 +7,8 @@
########################################################################
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
$undefined_variable_violates_strict_mode_and_test_should_not_compile;
View
@@ -1,6 +1,17 @@
use strict;
use FindBin qw($Bin);
+#
+# Shim to make Win32 behave during the test suite.
+#
+# Using fork+exec causes an APPCRASH during show_exceptions.t. Simply
+# reopening STDOUT and STDERR to the same duped filehandle causes errors in
+# the output where STDOUT and STDERR are written on top of each other (even
+# when autoflush is turned on). Reopening STDERR on top of STDOUT in the child
+# process seems to fix this problem.
+open(STDERR, ">&STDOUT") || die "can't reopen STDERR on STDOUT: $!";
+
+
{
package SpecStub;
sub new { bless do { \my $stub }, shift() }
@@ -25,16 +36,24 @@ sub capture_tap {
require File::Spec;
require File::Temp;
- my ($fh,$filename) = File::Temp::tempfile('tmpfileXXXXXX', UNLINK => 1, TMPDIR => 1);
- my $pid = fork || do {
- STDOUT->fdopen(fileno($fh), "w") || die "can't reopen stdout: $!";
- STDERR->fdopen(fileno($fh), "w") || die "can't reopen stderr: $!";
- exec($^X, (map { "-I$_" } @INC), File::Spec->catfile($Bin, $spec_name));
- die "couldn't exec '$spec_name'";
+ my ($fh,$filename) = File::Temp::tempfile('tmpfileXXXXXX', TMPDIR => 1);
+ close($fh);
+
+ open my $oldout, ">&STDOUT" or die "can't dup stdout: $!";
+ open my $olderr, ">&STDERR" or die "can't dup stderr: $!";
+ open(STDOUT, ">", $filename) || die "can't open '$filename' for out: $!";
+ open(STDERR, ">&STDOUT") || die "can't reopen stderr on stdout: $!";
+
+ system($^X, (map { "-I$_" } @INC), File::Spec->catfile($Bin, $spec_name));
+
+ open(STDERR, ">&", $olderr) || do {
+ print {$olderr} "can't reopen stderr: $! " . "at " . __FILE__ . " line " . __LINE__ . "\n";
+ exit(1);
};
- waitpid($pid,0);
- seek($fh, 0, 0);
+ open(STDOUT, ">&", $oldout) || die "can't reopen stdout: $!";
+ open($fh, "<", $filename) || die "can't open '$filename' for read: $!";
my $tap = do { local $/; <$fh> };
+ unlink($filename) || warn "can't unlink '$filename': $!";
return $tap;
}
View
@@ -9,6 +9,8 @@
#
use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
describe "Test::Spec";

0 comments on commit 039ce0a

Please sign in to comment.