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

Function TestShowArchitecture

cmd/architecture_test.go:10–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestShowArchitecture(t *testing.T) {
11 output, err := pkgstats(t, []string{"architecture"})
12 if err != nil {
13 t.Fatalf("Failed to run command: %v", err)
14 }
15
16 s := system.NewSystem()
17 osArchitecture, err := s.GetArchitecture()
18 if err != nil {
19 t.Fatal(err)
20 }
21 cpuArchitecture, err := s.GetCpuArchitecture()
22 if err != nil {
23 t.Fatal(err)
24 }
25
26 if !strings.Contains(output, osArchitecture) || !strings.Contains(output, cpuArchitecture) {
27 t.Fatalf("Expected OS and CPU architecture %s and %s, but got %s", osArchitecture, cpuArchitecture, strings.TrimSpace(output))
28 }
29}
30
31func TestShowOsArchitecture(t *testing.T) {
32 output, err := pkgstats(t, []string{"architecture", "os"})

Callers

nothing calls this directly

Calls 4

GetArchitectureMethod · 0.95
GetCpuArchitectureMethod · 0.95
NewSystemFunction · 0.92
pkgstatsFunction · 0.85

Tested by

no test coverage detected