From 0f7b5b7aeb4d224aa1de019d5c8815669f5b0dec Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 4 Sep 2015 00:44:01 +0200 Subject: [PATCH] t: replace variable root directory in tests Relative path substituted in commit 3.24-3-gaeeb9a5d49 (2015-09-14) [move i/o testing routines to Test::PLP module] works just as well. --- lib/Test/PLP.pm | 10 ++++------ t/50-cgi.t | 6 ++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/Test/PLP.pm b/lib/Test/PLP.pm index d1ebb4c..c030742 100644 --- a/lib/Test/PLP.pm +++ b/lib/Test/PLP.pm @@ -3,7 +3,6 @@ package Test::PLP; use strict; use warnings; -use Cwd; use PLP::Functions qw( DecodeURI ); require PLP::Backend::CGI; require PerlIO::scalar; @@ -17,7 +16,6 @@ our @EXPORT = qw( plp_is plp_ok ); $PLP::use_cache = 0 if $PLP::use_cache; #TODO: caching on (change file names) -my $ORGDIR = '.'; # Cwd::getcwd(); open ORGOUT, '>&', *STDOUT; sub is_string ($$;$) { @@ -52,10 +50,10 @@ sub _plp_run { GATEWAY_INTERFACE => 'CGI/1.1', SCRIPT_NAME => '/plp.cgi', - SCRIPT_FILENAME => "$ORGDIR/plp.cgi", + SCRIPT_FILENAME => "./plp.cgi", PATH_INFO => "/$src/test/123", - PATH_TRANSLATED => "$ORGDIR/$src/test/123", - DOCUMENT_ROOT => $ORGDIR, + PATH_TRANSLATED => "./$src/test/123", + DOCUMENT_ROOT => ".", $env ? %{$env} : (), ); # Apache/2.2.4 CGI environment @@ -139,7 +137,7 @@ sub plp_ok { $replace{HEAD} //= "Content-Type: text/html\nX-PLP-Version: $PLP::VERSION\n"; $replace{VERSION } //= $PLP::VERSION; $replace{SCRIPT_NAME } //= $infile; - $replace{SCRIPT_FILENAME} //= "$ORGDIR/$infile"; + $replace{SCRIPT_FILENAME} //= "./$infile"; chomp $out; $out =~ s/\$$_/$replace{$_}/g for keys %replace; diff --git a/t/50-cgi.t b/t/50-cgi.t index 09ebd0b..ed39da5 100644 --- a/t/50-cgi.t +++ b/t/50-cgi.t @@ -1,7 +1,6 @@ use strict; use warnings; -use Cwd; use File::Basename qw( dirname ); use File::Spec; use Test::More tests => 25; @@ -13,7 +12,6 @@ $PLP::use_cache = 0 if $PLP::use_cache; chdir File::Spec->catdir(dirname($0), '50-cgi') or BAIL_OUT('cannot change to test directory ./50-cgi/'); -my $ORGDIR = '.'; # Cwd::getcwd(); # 0*: permission checks using generated dummy files SKIP: @@ -47,7 +45,7 @@ plp_ok($_) for glob '[12]*.html'; SKIP: { my @inctests = glob '3*.html'; - my $INCFILE = File::Spec->rel2abs("$ORGDIR/missinginclude"); + my $INCFILE = File::Spec->rel2abs("./missinginclude"); if (open my $dummy, "<", $INCFILE) { # like PLP::source will fail("file missinginclude shouldn't exist"); skip("missinginclude tests (3*)", @inctests - 1); @@ -80,7 +78,7 @@ plp_ok($_, -env => { GATEWAY_INTERFACE => 'CGI/1.1', SCRIPT_NAME => "/$_", #XXX: .plp? - SCRIPT_FILENAME => "$ORGDIR/$_", + SCRIPT_FILENAME => "./$_", PATH_INFO => '/test/123', PATH_TRANSLATED => undef, DOCUMENT_ROOT => undef, -- 2.30.0