forked from Jguer/yay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
61 lines (45 loc) · 1.39 KB
/
main_test.go
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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/Jguer/yay/v10/pkg/settings"
)
func TestInitAlpm(t *testing.T) {
alpmHandle, pacmanConf, err := initAlpm(settings.MakeArguments(), "testdata/pacman.conf")
assert.Nil(t, err)
assert.NotNil(t, pacmanConf)
h := alpmHandle
root, err := h.Root()
assert.Nil(t, err)
assert.Equal(t, "/", root)
cache, err := h.CacheDirs()
assert.Nil(t, err)
assert.Equal(t, []string{"/cachedir/", "/another/"}, cache.Slice())
log, err := h.LogFile()
assert.Nil(t, err)
assert.Equal(t, "/logfile", log)
gpg, err := h.GPGDir()
assert.Nil(t, err)
assert.Equal(t, "/gpgdir/", gpg)
hook, err := h.HookDirs()
assert.Nil(t, err)
assert.Equal(t, []string{"/usr/share/libalpm/hooks/", "/hookdir/"}, hook.Slice())
arch, err := h.Arch()
assert.Nil(t, err)
assert.Equal(t, "8086", arch)
ignorePkg, err := h.IgnorePkgs()
assert.Nil(t, err)
assert.Equal(t, []string{"ignore", "this", "package"}, ignorePkg.Slice())
ignoreGroup, err := h.IgnoreGroups()
assert.Nil(t, err)
assert.Equal(t, []string{"ignore", "this", "group"}, ignoreGroup.Slice())
noUp, err := h.NoUpgrades()
assert.Nil(t, err)
assert.Equal(t, []string{"noupgrade"}, noUp.Slice())
noEx, err := h.NoExtracts()
assert.Nil(t, err)
assert.Equal(t, []string{"noextract"}, noEx.Slice())
check, err := h.CheckSpace()
assert.Nil(t, err)
assert.Equal(t, true, check)
}