Skip to content

Commit 8128fa0

Browse files
committed
Merge pull request #232 from paultcochrane/pr/unlink_tmp_file_after_tests
Unlink tmp file after tests
2 parents 9aee14f + bbeb540 commit 8128fa0

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

t/nqp/19-file-ops.t

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,12 @@ nqp::unlink($test-file ~ '-linked');
167167

168168
# symlink
169169

170-
my $tmp_file := "tmp";
170+
my $tmp-file := "tmp";
171171
my $env := nqp::getenvhash();
172172
$env<NQP_SHELL_TEST_ENV_VAR> := "123foo";
173-
nqp::shell("echo %NQP_SHELL_TEST_ENV_VAR% > $tmp_file",nqp::cwd(),$env);
174-
my $output := slurp($tmp_file);
173+
nqp::shell("echo %NQP_SHELL_TEST_ENV_VAR% > $tmp-file",nqp::cwd(),$env);
174+
my $output := slurp($tmp-file);
175+
nqp::unlink($tmp-file);
175176
my $is-windows := $output ne "%NQP_SHELL_TEST_ENV_VAR%\n";
176177

177178
if $is-windows {

t/nqp/78-shell.t

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ ok(nqp::ishash($a),'nqp::getenvhash() returns a hash');
99
ok($a<foo> == 123,'nqp::getenvhash() is a fresh hash');
1010
ok($b<foo> == 456,'nqp::getenvhash() is a fresh hash');
1111

12-
my $tmp_file := "tmp";
13-
nqp::shell("echo Hello > $tmp_file",nqp::cwd(),nqp::getenvhash());
14-
my $output := slurp($tmp_file);
12+
my $tmp-file := "tmp";
13+
nqp::shell("echo Hello > $tmp-file",nqp::cwd(),nqp::getenvhash());
14+
my $output := slurp($tmp-file);
1515
ok($output ~~ /^Hello/,'nqp::shell works with the echo shell command');
1616

1717
my $env := nqp::getenvhash();
1818
$env<NQP_SHELL_TEST_ENV_VAR> := "123foo";
1919

20-
nqp::shell("echo %NQP_SHELL_TEST_ENV_VAR% > $tmp_file",nqp::cwd(),$env);
21-
$output := slurp($tmp_file);
20+
nqp::shell("echo %NQP_SHELL_TEST_ENV_VAR% > $tmp-file",nqp::cwd(),$env);
21+
$output := slurp($tmp-file);
2222
if $output eq "%NQP_SHELL_TEST_ENV_VAR%\n" {
23-
nqp::shell("echo \$NQP_SHELL_TEST_ENV_VAR > $tmp_file",nqp::cwd(),$env);
24-
my $output := slurp($tmp_file);
23+
nqp::shell("echo \$NQP_SHELL_TEST_ENV_VAR > $tmp-file",nqp::cwd(),$env);
24+
my $output := slurp($tmp-file);
2525
ok($output eq "123foo\n","passing env variables to child processes works linux");
2626
} else {
2727
ok($output ~~ /^123foo/,"passing env variables to child processes works on windows");
2828
}
29+
nqp::unlink($tmp-file);

0 commit comments

Comments
 (0)