-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path3-helper-new.t
78 lines (61 loc) · 1.88 KB
/
3-helper-new.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
use Test;
use Ask;
use Mi6::Helper;
use File::Temp;
use App::Mi6;
use JSON::Fast;
use File::Directory::Tree;
use Proc::Easier;
# check the system for known values used for fez and mi6
my $oo = Mi6::Helper.new: :module-name("null");
my %fez = App::Mi6::JSON.decode(slurp "$*HOME/.fez-config.json");
my $auth = "zef:{%fez<un>}";
my $email = $oo.git-user-email;
my $author = $oo.git-user-name;
my $meta-author = "$author \<$email\>";
my $debug = 0;
# provide a unique testing directory by test file name
my $debug-base = "debug-test";
my $debug-dir = $debug-base ~ '/' ~ $?FILE.IO.basename;
# remove the trailing '.t*'
$debug-dir ~~ s/'.t'$//;
rmtree $debug-dir if $debug-dir.IO.d;
my ($tempdir, $res, $gs, $proc);
if not $debug {
# normal testing
$tempdir = tempdir;
}
else {
# development testing: preserves the output in dir '$tempdir'
$tempdir = mkdir $debug-dir;
}
ok $tempdir.IO.d;
{
# home info for a fez user is in file $HOME/.fez-config.json;
# "un" : "SOMEBODY",
# "key" : "some-hash-key",
temp $*CWD = $tempdir.IO;
#temp %*ENV<HOME> = $tempdir;
# DANGER DO NOT MODIFY THE USER'S ENVIRONMENT
chdir $tempdir;
#run "touch", '.Foo-Bar';
cmd "touch '.Foo-Bar'";
my $module-name = 'Foo::Bar';
my $parent-dir = "."; #$tempdir;
my $provides = "Provides a framistan";
if $debug {
note "DEBUG: module-name: $module-name";
note "DEBUG: parent-dir: $parent-dir";
}
=begin comment
mi6-helper-new(:$parent-dir, :$module-name, :$provides, :$debug);
my $moddir = $module-name;
$moddir ~~ s:g/'::'/-/;
ok $moddir.IO.d;
# check the meta file for known values
my %meta = App::Mi6::JSON.decode(slurp "$moddir/META6.json");
is %meta<auth>, $auth, "is auth $auth?";
#is @(%meta<authors>)[0], $author, "is author 1 $author?";
=end comment
}
done-testing;