MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / TestGetMachine

Function TestGetMachine

internal/system/system_linux_test.go:13–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestGetMachine(t *testing.T) {
14 arch, err := system.NewSystem().GetArchitecture()
15
16 expectedArch := func(arch string) bool { return arch == runtime.GOARCH }
17 switch runtime.GOARCH {
18 case "amd64":
19 expectedArch = func(arch string) bool { return strings.HasPrefix(arch, system.X86_64) }
20 case "386":
21 expectedArch = func(arch string) bool { return slices.Contains([]string{system.I586, system.I686}, arch) }
22 case "arm":
23 expectedArch = func(arch string) bool { return strings.HasPrefix(arch, "armv") }
24 case "arm64":
25 expectedArch = func(arch string) bool { return arch == system.AARCH64 }
26 case "loong64":
27 expectedArch = func(arch string) bool { return arch == "loongarch64" }
28 }
29
30 if err != nil {
31 t.Error(err)
32 }
33 if !expectedArch(arch) {
34 t.Error(arch)
35 }
36}
37
38func TestGetOSId(t *testing.T) {
39 sys := system.NewSystem()

Callers

nothing calls this directly

Calls 2

NewSystemFunction · 0.92
GetArchitectureMethod · 0.65

Tested by

no test coverage detected