Use custom tempfile in t/025-debug.t

Stop using the test "working dir".


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a2247002
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a2247002
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a2247002

Branch: refs/heads/master
Commit: a2247002411563c7121bdda5388f61c798c2c329
Parents: 5967a20
Author: Nick Wellnhofer <[email protected]>
Authored: Sat Dec 24 14:17:33 2016 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Mon Jan 2 16:33:56 2017 +0100

----------------------------------------------------------------------
 perl/t/025-debug.t | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a2247002/perl/t/025-debug.t
----------------------------------------------------------------------
diff --git a/perl/t/025-debug.t b/perl/t/025-debug.t
index ef9be1e..6ba0798 100644
--- a/perl/t/025-debug.t
+++ b/perl/t/025-debug.t
@@ -19,6 +19,7 @@ use lib 'buildlib';
 
 use Test::More;
 use File::Spec::Functions qw( catfile );
+use File::Temp qw( tempfile );
 use Fcntl;
 use Lucy::Util::Debug qw(
     DEBUG_ENABLED
@@ -27,7 +28,6 @@ use Lucy::Util::Debug qw(
     ASSERT
     set_env_cache
 );
-use Lucy::Test::TestUtils qw( working_dir );
 
 BEGIN {
     if ( !DEBUG_ENABLED() ) {
@@ -50,9 +50,9 @@ SKIP: {
     skip( "Windows redirect and fork not supported by Lucy", 6 )
         if $^O =~ /(mswin|cygwin)/i;
 
-    $stderr_dumpfile = catfile( working_dir(), 'lucy_garbage' );
-    unlink $stderr_dumpfile;
-    sysopen( STDERR, $stderr_dumpfile, O_CREAT | O_WRONLY | O_EXCL )
+    my $stderr_fh;
+    ( $stderr_fh, $stderr_dumpfile ) = tempfile( DIR => 't' );
+    open( STDERR, '>&', $stderr_fh )
         or die "Failed to redirect STDERR";
 
     DEBUG_PRINT("Roach Motel");

Reply via email to