-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path01-original-file.t
43 lines (33 loc) · 1.11 KB
/
01-original-file.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use v6;
use lib <lib/ t/lib>;
use Ake;
use Test;
plan 11;
my $path = $*TMPDIR.add: ‘ake-’ ~ (^999999).pick;
mkdir $path;
chdir $path; # ugly but OK
my $x = ‘’;
my $t = file ‘fred’, { $x = ‘meth’ }
$t.execute;
is $x, ‘meth’, ‘can execute file task via method’;
ok ‘fred’.IO.e, ‘file exists’;
$x = ‘’;
‘fred’.IO.unlink;
execute ‘fred’;
is $x, ‘meth’, ‘can execute file task by name’;
ok ‘fred’.IO.e, ‘file exists’;
(file ‘dino’ => ‘fred’, { $x = ‘sd’ }).execute;
is $x, ‘sd’, ‘single file dependency works fine’;
ok ‘dino’.IO.e, ‘file exists’;
(file ‘bedrock’ => <fred dino>, { $x = ‘md’ }).execute;
is $x, ‘md’, ‘multiple file dependencies work fine’;
ok ‘bedrock’.IO.e, ‘file exists’;
file ‘clear-headed-fred’, { $x = ‘again’ }
(file ‘wilma’ => <clear-headed-fred>).execute;
is $x, ‘again’, ‘body is optional’;
ok ‘clear-headed-fred’.IO.e, ‘file exists’;
ok ‘wilma’.IO.e, ‘file exists’;
for <fred dino bedrock clear-headed-fred wilma> {
.IO.unlink if .IO.e;
}
rmdir $path;