From 94ba710d20f88dcc6424ca983d612c38387a5b74 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 3 Sep 2015 19:54:24 +0200 Subject: [PATCH] t: rename abbreviated variables in Test::PLP --- lib/Test/PLP.pm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/Test/PLP.pm b/lib/Test/PLP.pm index c030742..1eec19b 100644 --- a/lib/Test/PLP.pm +++ b/lib/Test/PLP.pm @@ -41,7 +41,7 @@ eval { } or 1; sub _plp_run { - my ($src, $env, $in) = @_; + my ($src, $env, $input) = @_; %ENV = ( REQUEST_METHOD => 'GET', @@ -58,11 +58,11 @@ sub _plp_run { $env ? %{$env} : (), ); # Apache/2.2.4 CGI environment - if (defined $in) { - $ENV{CONTENT_LENGTH} //= length $in; + if (defined $input) { + $ENV{CONTENT_LENGTH} //= length $input; $ENV{CONTENT_TYPE} //= 'application/x-www-form-urlencoded'; close STDIN; - open STDIN, '<', $in; + open STDIN, '<', $input; } close STDOUT; @@ -84,11 +84,11 @@ sub _plp_run { } sub plp_is { - my ($name, $src, $expect, $env, $in) = @_; + my ($name, $src, $expect, $env, $input) = @_; my $tb = __PACKAGE__->builder; local $Test::Builder::Level = $Test::Builder::Level + 1; - my ($output, $failure) = _plp_run($src, $env, $in); + my ($output, $failure) = _plp_run($src, $env, $input); if ($failure) { $tb->ok(0, $name); $tb->diag(" Error: $failure"); @@ -117,17 +117,17 @@ sub plp_ok { (my $name = $file) =~ s/[.][^.]+$//; $file = "$name.html"; - my $infile = delete $replace{-input} // "$name.plp"; - my $addin = -e "$name.txt" && "$name.txt"; + my $src = delete $replace{-input} // "$name.plp"; + my $input = -e "$name.txt" && "$name.txt"; $name =~ s/^(\d*)-// and $name .= " ($1)"; DecodeURI($name); - my $out = eval { + my $output = eval { local $/ = undef; # slurp open my $fh, '<', $file or die "$!\n"; return readline $fh; }; - if (not defined $out) { + if (not defined $output) { $tb->ok(0, $name); $tb->diag("error reading output from $file: $@"); return; @@ -136,15 +136,15 @@ sub plp_ok { my $env = delete $replace{-env}; $replace{HEAD} //= "Content-Type: text/html\nX-PLP-Version: $PLP::VERSION\n"; $replace{VERSION } //= $PLP::VERSION; - $replace{SCRIPT_NAME } //= $infile; - $replace{SCRIPT_FILENAME} //= "./$infile"; + $replace{SCRIPT_NAME } //= $src; + $replace{SCRIPT_FILENAME} //= "./$src"; - chomp $out; - $out =~ s/\$$_/$replace{$_}/g for keys %replace; - $out =~ s{ + chomp $output; + $output =~ s/\$$_/$replace{$_}/g for keys %replace; + $output =~ s{ (.*?) - }{ _getwarning($2, $1, $infile) }msxge; + }{ _getwarning($2, $1, $src) }msxge; - plp_is($name, $infile, $out, $env, $addin); + plp_is($name, $src, $output, $env, $input); } -- 2.30.0