1
0
mirror of https://github.com/Jguer/yay synced 2024-07-08 04:16:16 +00:00
yay/main_test.go

52 lines
1.8 KiB
Go
Raw Normal View History

2018-09-10 20:25:38 +00:00
package main
import (
"testing"
2020-08-16 20:54:48 +00:00
"github.com/Morganamilo/go-pacmanconf"
"github.com/stretchr/testify/assert"
2020-07-08 01:22:01 +00:00
2021-09-08 20:28:08 +00:00
"github.com/Jguer/yay/v11/pkg/settings/parser"
2018-09-10 20:25:38 +00:00
)
2020-08-16 20:54:48 +00:00
func TestPacmanConf(t *testing.T) {
2021-08-11 18:13:28 +00:00
t.Parallel()
expectedPacmanConf := &pacmanconf.Config{
RootDir: "/",
2020-08-16 20:54:48 +00:00
DBPath: "//var/lib/pacman/",
CacheDir: []string{"/cachedir/", "/another/"},
HookDir: []string{"/hookdir/"},
GPGDir: "/gpgdir/",
LogFile: "/logfile",
HoldPkg: []string(nil),
IgnorePkg: []string{"ignore", "this", "package"},
IgnoreGroup: []string{"ignore", "this", "group"},
Architecture: []string{"8086"},
2020-08-16 20:54:48 +00:00
XferCommand: "",
NoUpgrade: []string{"noupgrade"},
NoExtract: []string{"noextract"},
CleanMethod: []string{"KeepInstalled"},
SigLevel: []string{"PackageOptional", "PackageTrustedOnly", "DatabaseOptional", "DatabaseTrustedOnly"},
LocalFileSigLevel: []string(nil),
RemoteFileSigLevel: []string(nil),
UseSyslog: false,
Color: false,
UseDelta: 0,
TotalDownload: false,
2020-08-16 20:54:48 +00:00
CheckSpace: true,
VerbosePkgLists: true,
DisableDownloadTimeout: false,
Repos: []pacmanconf.Repository{
{Name: "repo1", Servers: []string{"repo1"}, SigLevel: []string(nil), Usage: []string{"All"}},
{Name: "repo2", Servers: []string{"repo2"}, SigLevel: []string(nil), Usage: []string{"All"}},
},
}
2020-08-16 20:54:48 +00:00
pacmanConf, color, err := initAlpm(parser.MakeArguments(), "testdata/pacman.conf")
assert.Nil(t, err)
assert.NotNil(t, pacmanConf)
2020-08-08 16:43:37 +00:00
assert.Equal(t, color, false)
2020-08-16 20:54:48 +00:00
assert.EqualValues(t, expectedPacmanConf, pacmanConf)
2018-09-10 20:25:38 +00:00
}