This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deprecate above \xFF in bitwise string ops
[perl5.git] / t / op / hash-rt85026.t
index 61c0fb4..eb9264c 100644 (file)
@@ -1,29 +1,31 @@
 #!/usr/bin/perl -w
 
 BEGIN {
-  chdir 't';
-  @INC = '../lib';
+  chdir 't' if -d 't';
   require './test.pl';
+  set_up_inc( '../lib' );
   skip_all_without_dynamic_extension("Devel::Peek");
 }
 
 use strict;
 use Devel::Peek;
 use File::Temp qw(tempdir);
+use File::Spec;
 
 my %hash = map +($_ => 1), ("a".."z");
 
 my $tmp_dir = tempdir(CLEANUP => 1);
+my $tmp_file = File::Spec->catfile($tmp_dir, 'dump');
 
 sub riter {
     local *OLDERR;
     open(OLDERR, ">&STDERR") || die "Can't dup STDERR: $!";
-    open(STDERR, ">", "$tmp_dir/dump") ||
-        die "Could not open '$tmp_dir/dump' for write: $^E";
+    open(STDERR, ">", $tmp_file) ||
+        die "Could not open '$tmp_file' for write: $^E";
     Dump(\%hash);
     open(STDERR, ">&OLDERR") || die "Can't dup OLDERR: $!";
-    open(my $fh, "<", "$tmp_dir/dump") ||
-        die "Could not open '$tmp_dir/dump' for read: $^E";
+    open(my $fh, "<", $tmp_file) ||
+        die "Could not open '$tmp_file' for read: $^E";
     local $/;
     my $dump = <$fh>;
     my ($riter) = $dump =~ /^\s*RITER\s*=\s*(\d+)/m or
@@ -53,7 +55,7 @@ $| = 1;
 plan(1);
 
 # Ok all preparation is done
-diag <<"EOF"
+note <<"EOF"
 Found keys '$first_key' and '$second_key' on chain $riter
 Will now iterato to key '$first_key' then delete '$first_key' and '$second_key'.
 EOF
@@ -62,6 +64,6 @@ EOF
 delete $hash{$first_key};
 delete $hash{$second_key};
 
-diag "Now iterating into freed memory\n";
+note "Now iterating into freed memory\n";
 1 for each %hash;
 ok(1, "Survived!");