use strict;
use warnings;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
require Exporter;
our @ISA = qw(Exporter);
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
package Test::Builder::Tester;
use strict;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
package Test::Builder::Tester::Color;
use strict;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
sub import {
my $class = shift;
- if ($] == 5.010000) {
- require Test::More;
- Test::More::plan(skip_all => "Threads are broken on 5.10.0");
- }
-
unless ($works) {
require Test::More;
Test::More::plan(skip_all => "Skip no working threads");
Test::More::plan(skip_all => "This threaded test will only run when the '$var' environment variable is set.");
}
+ if ($] == 5.010000) {
+ require File::Temp;
+ require File::Spec;
+
+ my $perl = File::Spec->rel2abs($^X);
+ my ($fh, $fn) = File::Temp::tempfile();
+ print $fh <<' EOT';
+ BEGIN { print STDERR "# Checking for thread segfaults\n# " }
+ use threads;
+ my $t = threads->create(sub { 1 });
+ $t->join;
+ print STDERR "Threads appear to work\n";
+ exit 0;
+ EOT
+ close($fh);
+
+ my $exit = system(qq{"$perl" "$fn"});
+
+ if ($exit) {
+ require Test::More;
+ Test::More::plan(skip_all => "Threads segfault on this perl");
+ }
+ }
+
my $caller = caller;
eval "package $caller; use threads; 1" || die $@;
}
use strict;
use warnings;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
use strict;
use warnings;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-use Test::Stream 1.301001_093 '-internal';
+use Test::Stream 1.301001_096 '-internal';
use Test::Stream::Toolset;
use Test::Stream::Exporter;
use strict;
use warnings;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream::Context qw/context/;
confess "coderef must be a code reference"
unless ref($self->[CODEREF]) && reftype($self->[CODEREF]) eq 'CODE';
- require B;
+ $self->deduce;
+
+ $self->[PARAMS] ||= {};
+}
+
+sub deduce {
+ my $self = shift;
+
+ eval { require B; 1 } || return;
+
my $code = $self->[CODEREF];
my $cobj = B::svref_2object($code);
my $pkg = $cobj->GV->STASH->NAME;
$SUB_MAPS{$file}->{$line} = $self->[NAME];
- $self->[DEDUCED] = [$pkg, $file, $line, $subname];
- $self->[NAME] ||= $subname;
- $self->[PARAMS] ||= {};
+ $self->[DEDUCED] = [$pkg, $file, $line, $subname];
+ $self->[NAME] ||= $subname;
}
sub merge_params {
no strict 'refs';
local *GLOBCLONE = *{"$pkg\::$name"};
- undef *{"$pkg\::$name"};
+ my $stash = \%{"${pkg}\::"};
+ delete $stash->{$name};
for my $slot (@SLOTS) {
next if $slot eq $purge;
*{"$pkg\::$name"} = *GLOBCLONE{$slot} if defined *GLOBCLONE{$slot};
use vars qw( @ISA @EXPORT $VERSION );
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
@EXPORT = qw( run_tests check_tests check_test cmp_results show_space );
use warnings;
use 5.005;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
use Test::More 1.301001 ();
use Test::Stream::Carp qw/croak/;
-our $VERSION = '1.301001_093';
+our $VERSION = '1.301001_096';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
sub import {
is($main::export::xxx, 'here', "still have an \$export::* var");
ok(!__PACKAGE__->can($_), "removed $_\()") for qw/export default_export exports default_exports/;
-
- my $ok = eval {
- export no => sub { 'no' };
- 1;
- };
- my $error = $@;
- ok(!$ok, "Cannot add exports after cleanup");
- like($error, qr/Undefined subroutine &My::Exporter::export called/, "Sub was removed");
}
My::Exporter->import( '!x' );
is($foo, 'foo', '$foo is still defined');
is_deeply(\@foo, [ 'f', 'o', 'o' ], '@foo is still defined');
is_deeply(\%foo, { f => 'oo' }, '%foo is still defined');
-my $r = eval { foo() };
+my $r = eval { __PACKAGE__->foo() };
my $e = $@;
ok(!$r, "Failed to call foo()");
-like($e, qr/Undefined subroutine &main::foo called/, "foo() is not defined anymore");
+like($e, qr/Can't locate object method "foo" via package "main"/, "foo() is not defined anymore");
ok(!__PACKAGE__->can('foo'), "can() no longer thinks we can do foo()");
done_testing;