Skip to content

Commit cbb5c3f

Browse files
committed
Use existing util functions
1 parent a58a69c commit cbb5c3f

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

S32-io/child-secure.t

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,9 @@
11
use Test;
2+
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
3+
use Test::Util;
24

35
plan 10;
46

5-
sub make-rand-path (--> IO::Path:D) {
6-
$*TMPDIR.resolve.child: (
7-
'raku_roast_',
8-
$*PROGRAM.basename, '_line',
9-
((try callframe(3).code.line)||''), '_',
10-
rand,
11-
time,
12-
).join.subst: :g, /\W/, '_';
13-
}
14-
15-
my @FILES-FOR-make-temp-file;
16-
my @DIRS-FOR-make-temp-dir;
17-
END {
18-
unlink @FILES-FOR-make-temp-file;
19-
rmdir @DIRS-FOR-make-temp-dir;
20-
}
21-
22-
sub make-temp-file (
23-
:$content where Any:U|Blob|Cool,
24-
Int :$chmod
25-
--> IO::Path:D) {
26-
@FILES-FOR-make-temp-file.push: my \path = make-rand-path;
27-
with $chmod {
28-
path.spurt: $content // '';
29-
path.chmod: $_
30-
}
31-
orwith $content {
32-
path.spurt: $_
33-
}
34-
path
35-
}
36-
37-
sub make-temp-dir (Int $chmod? --> IO::Path:D) {
38-
@DIRS-FOR-make-temp-dir.push: my \path = make-rand-path;
39-
path.mkdir;
40-
path.chmod: $_ with $chmod;
41-
path
42-
}
43-
447
sub failuring-like (&test, $ex-type, $reason?, *%matcher) {
458
todo $_ with $*NOT-IMPL-TODO;
469
subtest $reason => sub {
@@ -62,10 +25,6 @@ sub failuring-like (&test, $ex-type, $reason?, *%matcher) {
6225
my $parent := make-temp-dir;
6326
my $non-resolving-parent := make-temp-file.child('bar');
6427

65-
sub is-path ($got, $expected, $desc) is test-assertion {
66-
cmp-ok $got.resolve, '~~', $expected.resolve, $desc
67-
}
68-
6928
{
7029
#?rakudo emit my $*NOT-IMPL-TODO = "IO::Path doesn't implement :secure yet";
7130

0 commit comments

Comments
 (0)