v / cmd / tools / vpm / remove_test.v
28 lines · 24 sloc · 646 bytes · 770a2db50333dcd987317fdbbe75456758336b89
Raw
1// vtest retry: 3
2import os
3import rand
4import test_utils
5
6const vexe = os.quoted_path(@VEXE)
7const test_path = os.join_path(os.vtmp_dir(), 'vpm_remove_test_${rand.ulid()}')
8
9fn testsuite_begin() {
10 $if !network ? {
11 eprintln('> skipping ${@FILE}, when `-d network` is missing')
12 exit(0)
13 }
14 dump(test_path)
15 test_utils.set_test_env(test_path)
16}
17
18fn testsuite_end() {
19 os.rmdir_all(test_path) or {}
20}
21
22fn test_remove() {
23 os.execute_or_exit('${vexe} install https://github.com/hungrybluedev/xlsx')
24 mod_path := os.join_path(test_path, 'xlsx')
25 assert os.is_dir(mod_path)
26 res := os.execute('${vexe} remove xlsx')
27 assert !os.exists(mod_path)
28}
29