git.shiar.nl
/
perl
/
plp
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0f7b5b7
)
t: rename abbreviated variables in Test::PLP
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 3 Sep 2015 17:54:24 +0000
(19:54 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 31 Mar 2018 20:58:53 +0000
(22:58 +0200)
lib/Test/PLP.pm
patch
|
blob
|
history
diff --git
a/lib/Test/PLP.pm
b/lib/Test/PLP.pm
index c030742a137b43b5e5261de76090f11b43c9cb03..1eec19b1269bd7b1f2be0f6d174edaf4dbff6daa 100644
(file)
--- a/
lib/Test/PLP.pm
+++ b/
lib/Test/PLP.pm
@@
-41,7
+41,7
@@
eval {
} or 1;
sub _plp_run {
} or 1;
sub _plp_run {
- my ($src, $env, $in) = @_;
+ my ($src, $env, $in
put
) = @_;
%ENV = (
REQUEST_METHOD => 'GET',
%ENV = (
REQUEST_METHOD => 'GET',
@@
-58,11
+58,11
@@
sub _plp_run {
$env ? %{$env} : (),
); # Apache/2.2.4 CGI environment
$env ? %{$env} : (),
); # Apache/2.2.4 CGI environment
- if (defined $in) {
- $ENV{CONTENT_LENGTH} //= length $in;
+ if (defined $in
put
) {
+ $ENV{CONTENT_LENGTH} //= length $in
put
;
$ENV{CONTENT_TYPE} //= 'application/x-www-form-urlencoded';
close STDIN;
$ENV{CONTENT_TYPE} //= 'application/x-www-form-urlencoded';
close STDIN;
- open STDIN, '<', $in;
+ open STDIN, '<', $in
put
;
}
close STDOUT;
}
close STDOUT;
@@
-84,11
+84,11
@@
sub _plp_run {
}
sub plp_is {
}
sub plp_is {
- my ($name, $src, $expect, $env, $in) = @_;
+ my ($name, $src, $expect, $env, $in
put
) = @_;
my $tb = __PACKAGE__->builder;
local $Test::Builder::Level = $Test::Builder::Level + 1;
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, $in
put
);
if ($failure) {
$tb->ok(0, $name);
$tb->diag(" Error: $failure");
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 $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);
$name =~ s/^(\d*)-// and $name .= " ($1)";
DecodeURI($name);
- my $out = eval {
+ my $out
put
= eval {
local $/ = undef; # slurp
open my $fh, '<', $file or die "$!\n";
return readline $fh;
};
local $/ = undef; # slurp
open my $fh, '<', $file or die "$!\n";
return readline $fh;
};
- if (not defined $out) {
+ if (not defined $out
put
) {
$tb->ok(0, $name);
$tb->diag("error reading output from $file: $@");
return;
$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;
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 $out
put
;
+ $out
put
=~ s/\$$_/$replace{$_}/g for keys %replace;
+ $out
put
=~ s{
<eval \s+ line="([^"]*)"> (.*?) </eval>
<eval \s+ line="([^"]*)"> (.*?) </eval>
- }{ _getwarning($2, $1, $
infile
) }msxge;
+ }{ _getwarning($2, $1, $
src
) }msxge;
- plp_is($name, $
infile, $out, $env, $addin
);
+ plp_is($name, $
src, $output, $env, $input
);
}
}