Skip to content

Commit

Permalink
Merge branch 'issue_36_redux'
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jan 7, 2023
2 parents 6ca8110 + 3e987aa commit ef246e8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Test/Deep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ while (my ($pkg, $name) = splice @constructors, 0, 2)
my $file = "$full_pkg.pm";
$file =~ s#::#/#g;
my $sub = sub {
# We might be in the middle of testing one of the globals that require()
# overwrites. To simplify test authorship, we'll preserve any existing
# value.
local $@;
local $!;
local $^E;

require $file;

return $full_pkg->new(@_);
};
{
Expand Down
17 changes: 17 additions & 0 deletions t/all_any_noclobber_dollar_at.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use strict;
use warnings;
use lib 't/lib';

use Std;

{
$@ = 'hello';
all(123);
is( $@, 'hello', 'all() doesn’t overwrite $@' );
}

{
$@ = 'hello';
any(123);
is( $@, 'hello', 'any() doesn’t overwrite $@' );
}
17 changes: 17 additions & 0 deletions t/all_any_noclobber_dollar_bang.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use strict;
use warnings;
use lib 't/lib';

use Std;

{
$! = 11;
all(123);
is( 0 + $!, 11, 'all() doesn’t overwrite $!' );
}

{
$! = 11;
any(123);
is( 0 + $!, 11, 'any() doesn’t overwrite $!' );
}
17 changes: 17 additions & 0 deletions t/all_any_noclobber_dollar_e.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use strict;
use warnings;
use lib 't/lib';

use Std;

{
$^E = 11;
all(123);
is( 0 + $^E, 11, 'all() doesn’t overwrite $^E' );
}

{
$^E = 11;
any(123);
is( 0 + $^E, 11, 'any() doesn’t overwrite $^E' );
}

0 comments on commit ef246e8

Please sign in to comment.