Przeglądaj źródła

fix test using multiple 'Architecture' value

Signed-off-by: x1b6e6 <ftdabcde@gmail.com>
x1b6e6 4 lat temu
rodzic
commit
767c7975f3

+ 1 - 1
main_test.go

@@ -20,7 +20,7 @@ func TestPacmanConf(t *testing.T) {
 		HoldPkg:                []string(nil),
 		IgnorePkg:              []string{"ignore", "this", "package"},
 		IgnoreGroup:            []string{"ignore", "this", "group"},
-		Architecture:           "8086",
+		Architecture:           []string{"8086"},
 		XferCommand:            "",
 		NoUpgrade:              []string{"noupgrade"},
 		NoExtract:              []string{"noextract"},

+ 13 - 0
pkg/db/ialpm/alpm_five_test.go

@@ -0,0 +1,13 @@
+// +build !six
+
+package ialpm
+
+import (
+	alpm "github.com/Jguer/go-alpm/v2"
+)
+
+func alpmTestGetArch(h *alpm.Handle) ([]string, error) {
+	arch, err := h.Arch()
+
+	return []string{arch}, err
+}

+ 13 - 0
pkg/db/ialpm/alpm_six_test.go

@@ -0,0 +1,13 @@
+// +build six
+
+package ialpm
+
+import (
+	alpm "github.com/Jguer/go-alpm/v2"
+)
+
+func alpmTestGetArch(h *alpm.Handle) ([]string, error) {
+	architectures, err := h.GetArchitectures()
+
+	return architectures.Slice(), err
+}

+ 3 - 3
pkg/db/ialpm/alpm_test.go

@@ -18,7 +18,7 @@ func TestAlpmExecutor(t *testing.T) {
 		HoldPkg:                []string(nil),
 		IgnorePkg:              []string{"ignore", "this", "package"},
 		IgnoreGroup:            []string{"ignore", "this", "group"},
-		Architecture:           "8086",
+		Architecture:           []string{"8086"},
 		XferCommand:            "",
 		NoUpgrade:              []string{"noupgrade"},
 		NoExtract:              []string{"noextract"},
@@ -75,9 +75,9 @@ func TestAlpmExecutor(t *testing.T) {
 	assert.Nil(t, err)
 	assert.Equal(t, []string{"/usr/share/libalpm/hooks/", "/hookdir/"}, hook.Slice())
 
-	arch, err := h.Arch()
+	arch, err := alpmTestGetArch(h)
 	assert.Nil(t, err)
-	assert.Equal(t, "8086", arch)
+	assert.Equal(t, []string{"8086"}, arch)
 
 	ignorePkg, err := h.IgnorePkgs()
 	assert.Nil(t, err)