This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/lib/croak/regcomp: Fix up for EBCDIC
[perl5.git] / t / lib / deprecate.t
index fb11528..09b258f 100644 (file)
@@ -1,13 +1,14 @@
+#!perl -w
 use strict;
 
 BEGIN {
-       chdir 't' if -d 't';
-       @INC = qw(../lib);
+    chdir 't' if -d 't';
+    require './test.pl';
 }
 use File::Copy ();
 use File::Path ();
 use File::Spec ();
-use Test::More tests => 10;
+plan(tests => 10);
 
 my $test_dir = File::Spec->catdir(qw(lib deprecate));
 chdir $test_dir or die "Can't chdir $test_dir";
@@ -31,6 +32,7 @@ our %tests = (
        sitearchexp     => 0,
 );
 
+no warnings 'once';
 local %deprecate::Config = (%libdir);
 
 my $module = 'Deprecated.pm';
@@ -48,14 +50,15 @@ for my $lib (sort keys %tests) {
     }
     if( $tests{$lib} ) {
         like($warn, qr/^Deprecated\s+will\s+be\s+removed\b/, "$lib - message");
-        like($warn, qr/$0,?\s+line\s+1001\.?\n*$/, "$lib - location");
+        my $me = quotemeta($0);
+        like($warn, qr/$me,?\s+line\s+1001\.?\n*$/, "$lib - location");
     }
     else {
        ok( !$warn, "$lib - no message" );
     }
 
     delete $INC{$module};
-    unlink $pm;
+    unlink_all $pm;
 }
 
 my $sub_dir = 'Optionally';
@@ -81,7 +84,7 @@ for my $lib (sort keys %tests) {
     }
 
     delete $INC{"$sub_dir/$module"};
-    unlink $pm;
+    unlink_all $pm;
 }
 
 END { File::Path::remove_tree('lib') }