-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.nu
executable file
·36 lines (34 loc) · 1.19 KB
/
test.nu
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
#!/usr/bin/env nu
let tempdir = (mktemp --directory)
let template = $env.PWD
for command_is_simple in [Yes, No] {
for multi_command in [Yes, No] {
print ($"Testing with command_is_simple=($command_is_simple), " ++
$"multi_command=($multi_command)")
try {
do --capture-errors {
cd $tempdir
(
^cargo generate
--path $template
--force
--silent
--name nu_plugin_test_plugin
--define command_name="test command"
--define $"command_is_simple=($command_is_simple)"
--define $"multi_command=($multi_command)"
--define github_username=
)
do { cd nu_plugin_test_plugin; ^cargo test }
rm -r nu_plugin_test_plugin
}
} catch { |err|
print -e ($"Failed with command_is_simple=($command_is_simple), " ++
$"multi_command=($multi_command)")
rm -rf $tempdir
$err.raw
}
}
}
rm -rf $tempdir
print "All tests passed."