Permalink
Browse files

fix naming of some test temp files

The files should be named t/tmp*, to fall under .gitignore and be ignored
by podcheck.
  • Loading branch information...
Zefram
Zefram committed Nov 14, 2017
1 parent 68e4117 commit c0a22fcc1cf66dc415acf252a180a384f2e4d360
Showing with 70 additions and 69 deletions.
  1. +3 −3 t/comp/utf.t
  2. +26 −26 t/io/argv.t
  3. +1 −1 t/op/taint.t
  4. +3 −2 t/porting/extrefs.t
  5. +7 −7 t/run/runenv.t
  6. +29 −29 t/run/switches.t
  7. +1 −1 t/test.pl
View
@@ -34,11 +34,11 @@ sub bytes_to_utf {
sub test {
my ($enc, $write, $expect, $bom, $nl, $name) = @_;
open my $fh, ">", "utf$$.pl" or die "utf.pl: $!";
open my $fh, ">", "tmputf$$.pl" or die "tmputf$$.pl: $!";
binmode $fh;
print $fh bytes_to_utf($enc, $write . ($nl ? "\n" : ''), $bom);
close $fh or die $!;
my $got = do "./utf$$.pl";
my $got = do "./tmputf$$.pl";
$test = $test + 1;
if (!defined $got) {
if ($@ =~ /^(Unsupported script encoding \Q$enc\E)/) {
@@ -100,5 +100,5 @@ for my $bom (0, 1) {
}
END {
1 while unlink "utf$$.pl";
1 while unlink "tmputf$$.pl";
}
View
@@ -17,24 +17,24 @@ if (is_miniperl()) {
$devnull = File::Spec->devnull;
}
open(TRY, '>Io_argv1.tmp') || (die "Can't open temp file: $!");
open(TRY, '>tmpIo_argv1.tmp') || (die "Can't open temp file: $!");
print TRY "a line\n";
close TRY or die "Could not close: $!";
open(TRY, '>Io_argv2.tmp') || (die "Can't open temp file: $!");
open(TRY, '>tmpIo_argv2.tmp') || (die "Can't open temp file: $!");
print TRY "another line\n";
close TRY or die "Could not close: $!";
$x = runperl(
prog => 'while (<>) { print $., $_; }',
args => [ 'Io_argv1.tmp', 'Io_argv1.tmp' ],
args => [ 'tmpIo_argv1.tmp', 'tmpIo_argv1.tmp' ],
);
is($x, "1a line\n2a line\n", '<> from two files');
{
$x = runperl(
prog => 'while (<>) { print $_; }',
stdin => "foo\n",
args => [ 'Io_argv1.tmp', '-' ],
args => [ 'tmpIo_argv1.tmp', '-' ],
);
is($x, "a line\nfoo\n", '<> from a file and STDIN');
@@ -55,9 +55,9 @@ is($x, "1a line\n2a line\n", '<> from two files');
$x = runperl(
prog => 'while (<>) { print $ARGV.q/,/.$_ }',
args => [ 'Io_argv1.tmp', 'Io_argv2.tmp' ],
args => [ 'tmpIo_argv1.tmp', 'tmpIo_argv2.tmp' ],
);
is($x, "Io_argv1.tmp,a line\nIo_argv2.tmp,another line\n", '$ARGV is the file name');
is($x, "tmpIo_argv1.tmp,a line\ntmpIo_argv2.tmp,another line\n", '$ARGV is the file name');
TODO: {
local $::TODO = "unrelated bug in redirection implementation" if $^O eq 'VMS';
@@ -83,8 +83,8 @@ TODO: {
is( 0+$?, 0, q(eof() doesn't segfault) );
}
@ARGV = is_miniperl() ? ('Io_argv1.tmp', 'Io_argv1.tmp', 'Io_argv1.tmp')
: ('Io_argv1.tmp', 'Io_argv1.tmp', $devnull, 'Io_argv1.tmp');
@ARGV = is_miniperl() ? ('tmpIo_argv1.tmp', 'tmpIo_argv1.tmp', 'tmpIo_argv1.tmp')
: ('tmpIo_argv1.tmp', 'tmpIo_argv1.tmp', $devnull, 'tmpIo_argv1.tmp');
while (<>) {
$y .= $. . $_;
if (eof()) {
@@ -95,11 +95,11 @@ while (<>) {
is($y, "1a line\n2a line\n3a line\n", '<> from @ARGV');
open(TRY, '>Io_argv1.tmp') or die "Can't open temp file: $!";
open(TRY, '>tmpIo_argv1.tmp') or die "Can't open temp file: $!";
close TRY or die "Could not close: $!";
open(TRY, '>Io_argv2.tmp') or die "Can't open temp file: $!";
open(TRY, '>tmpIo_argv2.tmp') or die "Can't open temp file: $!";
close TRY or die "Could not close: $!";
@ARGV = ('Io_argv1.tmp', 'Io_argv2.tmp');
@ARGV = ('tmpIo_argv1.tmp', 'tmpIo_argv2.tmp');
$^I = '_bak'; # not .bak which confuses VMS
$/ = undef;
my $i = 11;
@@ -109,9 +109,9 @@ while (<>) {
print;
next_test();
}
open(TRY, '<Io_argv1.tmp') or die "Can't open temp file: $!";
open(TRY, '<tmpIo_argv1.tmp') or die "Can't open temp file: $!";
print while <TRY>;
open(TRY, '<Io_argv2.tmp') or die "Can't open temp file: $!";
open(TRY, '<tmpIo_argv2.tmp') or die "Can't open temp file: $!";
print while <TRY>;
close TRY or die "Could not close: $!";
undef $^I;
@@ -123,7 +123,7 @@ ok( eof TRY );
ok( eof NEVEROPENED, 'eof() true on unopened filehandle' );
}
open STDIN, 'Io_argv1.tmp' or die $!;
open STDIN, 'tmpIo_argv1.tmp' or die $!;
@ARGV = ();
ok( !eof(), 'STDIN has something' );
@@ -135,7 +135,7 @@ SKIP: {
@ARGV = ();
ok( eof(), 'eof() true with empty @ARGV' );
@ARGV = ('Io_argv1.tmp');
@ARGV = ('tmpIo_argv1.tmp');
ok( !eof() );
@ARGV = ($devnull, $devnull);
@@ -147,7 +147,7 @@ SKIP: {
SKIP: {
local $/;
open my $fh, 'Io_argv1.tmp' or die "Could not open Io_argv1.tmp: $!";
open my $fh, 'tmpIo_argv1.tmp' or die "Could not open tmpIo_argv1.tmp: $!";
<$fh>; # set $. = 1
is( <$fh>, undef );
@@ -165,19 +165,19 @@ SKIP: {
close $fh or die "Could not close: $!";
}
open(TRY, '>Io_argv1.tmp') || (die "Can't open temp file: $!");
open(TRY, '>tmpIo_argv1.tmp') || (die "Can't open temp file: $!");
print TRY "one\n\nthree\n";
close TRY or die "Could not close: $!";
$x = runperl(
prog => 'print $..$ARGV.$_ while <<>>',
args => [ 'Io_argv1.tmp' ],
args => [ 'tmpIo_argv1.tmp' ],
);
is($x, "1Io_argv1.tmpone\n2Io_argv1.tmp\n3Io_argv1.tmpthree\n", '<<>>');
is($x, "1tmpIo_argv1.tmpone\n2tmpIo_argv1.tmp\n3tmpIo_argv1.tmpthree\n", '<<>>');
$x = runperl(
prog => '$w=q/b/;$w.=<<>>;print $w',
args => [ 'Io_argv1.tmp' ],
args => [ 'tmpIo_argv1.tmp' ],
);
is($x, "bone\n", '<<>> and rcatline');
@@ -232,24 +232,24 @@ SKIP: {
$x = runperl(
prog => 'while (<<>>) { }',
stderr => 1,
args => [ 'Io_argv1.tmp', '"echo foo |"' ],
args => [ 'tmpIo_argv1.tmp', '"echo foo |"' ],
);
like($x, qr/^Can't open echo foo \|: .* at -e line 1, <> line 3/, '<<>> does not treat ...| as fork after eof');
}
# This used to dump core
fresh_perl_is( <<'**PROG**', "foobar", {}, "ARGV aliasing and eof()" );
open OUT, ">Io_argv3.tmp" or die "Can't open temp file: $!";
open OUT, ">tmpIo_argv3.tmp" or die "Can't open temp file: $!";
print OUT "foo";
close OUT;
open IN, "Io_argv3.tmp" or die "Can't open temp file: $!";
open IN, "tmpIo_argv3.tmp" or die "Can't open temp file: $!";
*ARGV = *IN;
while (<>) {
print;
print "bar" if eof();
}
close IN;
unlink "Io_argv3.tmp";
unlink "tmpIo_argv3.tmp";
**PROG**
# This used to fail an assertion.
@@ -263,6 +263,6 @@ is runperl(prog => 'undef *x; delete $::{ARGV}; $x++;'
"ok\n", 'deleting $::{ARGV}';
END {
unlink_all 'Io_argv1.tmp', 'Io_argv1.tmp_bak',
'Io_argv2.tmp', 'Io_argv2.tmp_bak', 'Io_argv3.tmp';
unlink_all 'tmpIo_argv1.tmp', 'tmpIo_argv1.tmp_bak',
'tmpIo_argv2.tmp', 'tmpIo_argv2.tmp_bak', 'tmpIo_argv3.tmp';
}
View
@@ -123,7 +123,7 @@ sub violates_taint {
}
# We need an external program to call.
my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : ($Is_NetWare ? "echo$$" : "./echo$$"));
my $ECHO = ($Is_MSWin32 ? ".\\tmpecho$$" : ($Is_NetWare ? "tmpecho$$" : "./tmpecho$$"));
END { unlink $ECHO }
open my $fh, '>', $ECHO or die "Can't create $ECHO: $!";
print $fh 'print "@ARGV\n"', "\n";
View
@@ -70,13 +70,14 @@ sub try_compile_and_link {
return 0;
}
my $COREincdir = File::Spec->catdir(File::Spec->updir);
my $COREincdir =
File::Spec->catdir(File::Spec->updir, File::Spec->updir);
my $ccflags = $Config{'ccflags'} . ' ' . "-I$COREincdir"
. ' -DPERL_NO_INLINE_FUNCTIONS';
if ($^O eq "MSWin32") {
$ccflags .= " -I../win32 -I../win32/include";
$ccflags .= " -I../../win32 -I../../win32/include";
}
my $libs = '';
View
@@ -140,18 +140,18 @@ try({PERL5OPT => '-Mstrict -Mwarnings'},
"ok",
"");
open my $fh, ">", "Oooof.pm" or die "Can't write Oooof.pm: $!";
print $fh "package Oooof; 1;\n";
open my $fh, ">", "tmpOooof.pm" or die "Can't write tmpOooof.pm: $!";
print $fh "package tmpOooof; 1;\n";
close $fh;
END { 1 while unlink "Oooof.pm" }
END { 1 while unlink "tmpOooof.pm" }
try({PERL5OPT => '-I. -MOooof'},
['-e', 'print "ok" if $INC{"Oooof.pm"} eq "Oooof.pm"'],
try({PERL5OPT => '-I. -MtmpOooof'},
['-e', 'print "ok" if $INC{"tmpOooof.pm"} eq "tmpOooof.pm"'],
"ok",
"");
try({PERL5OPT => '-I./ -MOooof'},
['-e', 'print "ok" if $INC{"Oooof.pm"} eq "Oooof.pm"'],
try({PERL5OPT => '-I./ -MtmpOooof'},
['-e', 'print "ok" if $INC{"tmpOooof.pm"} eq "tmpOooof.pm"'],
"ok",
"");
Oops, something went wrong.

0 comments on commit c0a22fc

Please sign in to comment.