1
1
use Test ;
2
+ use lib $ ? FILE . IO . parent (2 ). add(" packages/Test-Helpers" );
3
+ use Test ::Util;
2
4
3
5
plan 10 ;
4
6
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
-
44
7
sub failuring-like (& test , $ ex-type , $ reason ? , * % matcher ) {
45
8
todo $ _ with $ * NOT-IMPL-TODO ;
46
9
subtest $ reason => sub {
@@ -62,10 +25,6 @@ sub failuring-like (&test, $ex-type, $reason?, *%matcher) {
62
25
my $ parent := make-temp-dir;
63
26
my $ non-resolving-parent := make-temp-file. child (' bar' );
64
27
65
- sub is-path ($ got , $ expected , $ desc ) is test-assertion {
66
- cmp-ok $ got . resolve , ' ~~' , $ expected . resolve , $ desc
67
- }
68
-
69
28
{
70
29
# ?rakudo emit my $*NOT-IMPL-TODO = "IO::Path doesn't implement :secure yet";
71
30
0 commit comments