package main // The desktop applications whose bundles carry desktop.go. Each builds alone, so each has its own copy; // this test, itself one of the copied files, holds them to one text wherever the siblings are present. import ( "bytes" "os" "path/filepath" "testing" ) var carriers = []string{"blueman", "forticlient", "nextcloud-client", "nm-applet", "openrazer", "polychromatic", "slack"} func TestEveryDesktopApplicationCarriesTheSameCopy(t *testing.T) { compared := 0 for _, module := range carriers { dir := filepath.Join("..", "..", "..", module, "cmd", module+"-tools") if _, err := os.Stat(dir); err != nil { continue } for _, f := range []string{"desktop.go", "desktop_test.go", "copies_test.go"} { mine, err := os.ReadFile(f) if err != nil { t.Fatal(err) } theirs, err := os.ReadFile(filepath.Join(dir, f)) if err != nil || !bytes.Equal(mine, theirs) { t.Errorf("%s's copy of %s differs from this one: change every copy together", module, f) } } compared++ } if compared == 0 { t.Log("no sibling copies beside this module") } }