summaryrefslogtreecommitdiff
path: root/test/addremove
blob: 23196e1d101e055d03299caf9d77141bd922f87e (plain)
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
## vim:ft=zsh
file=${repo%-*}
if [[ $repo == *-bare ]] {
	echo "## bare repository"
	complement=$file
} else {
	echo "## non-bare repository"
	complement=${repo}-bare
}
echo "# pkg add (ok)"
pkg add $repo
[[ -e $test_pdir/$repo/foo ]]
[[ -d $test_pdir/$repo/.git ]]

echo "# pkg add (already installed)"
! pkg add $repo

echo "# populate_collected"
[[ -L $test_home/bin/$file ]]
[[ -x $(readlink $test_home/bin/$file) ]]
[[ -e $test_pdir/.collected/man/man2/$file.2 ]]

repeat 2 {
	echo "# pkg list"
	stringcmp "core\n$repo" "$(pkg list local)"
	stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)"
	stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)"
	pkg update
}

echo "# pkg remove (not installed/nonexistent)"
! pkg remove suckage
! pkg remove rb

echo "# pkg remove (ok)"
pkg remove $repo

echo "# genocide_collected (~/bin)"
[[ ! -L $test_home/bin/$file ]]
[[ ! -e $test_pdir/.collected/man/man2/$file.2 ]]

repeat 2 {
	echo "# pkg list"
	stringcmp "core" "$(pkg list local)"
	stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)"
	stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)"
	pkg update
}