package resolution import ( "strings" "testing" mcat "git.novox.be/novox/mesh-sdk/go/catalogue" ) func TestTwoModulesSettingOneVariableAreRefused(t *testing.T) { // A module that sets a variable twice, in two modules, is refused as the old form refused it. a := mcat.Manifest{Module: "a", Items: []mcat.Item{{Collection: "environment", Content: "1\n", Attributes: map[string]string{"kind": "variable", "name": "X"}}}} b := mcat.Manifest{Module: "b", Items: []mcat.Item{{Collection: "environment", Content: "2\n", Attributes: map[string]string{"kind": "variable", "name": "X"}}}} if err := variablesSetOnce([]mcat.Manifest{a, b}); err == nil || !strings.Contains(err.Error(), "both set X") { t.Errorf("two modules setting X: %v", err) } }