package main import ( "path/filepath" "testing" "git.novox.be/novox/mesh-catalog/checks/trunk" ) // The script's run of this check over the real tree (novox/hq ADR 0529 clause 2): no module names another's state on its machine, // and the known list holds only what still occurs. func TestNoModuleNamesAnothersState(t *testing.T) { root := filepath.Join("..", "..") found, err := Check(root) if err != nil { t.Fatal(err) } shared, _, err := list("shared") if err != nil { t.Fatal(err) } known, _, err := list("known") if err != nil { t.Fatal(err) } refused, gone := Judge(found, shared, known) for _, f := range refused { t.Error(f) } for _, k := range gone { t.Errorf("%q is in checks/paths/known and no longer occurs: take it out, so it cannot come back", k) } } // And neither list gains a line the trunk's copies at the merge base do not hold, unless the line says why after `# allow:`. Fails, saying // NOT COMPARED, where no trunk is beside (issue 1295). func TestTheListsOfPathsHoldNoLineTheTrunksDoNot(t *testing.T) { sharedPath, okShared := trunk.Copy(t, "checks/paths/shared") knownPath, okKnown := trunk.Copy(t, "checks/paths/known") if !okShared || !okKnown { t.Log("the trunk holds not both lists: their first copies, to which nothing was added") return } shared, sharedWhy, err := list("shared") if err != nil { t.Fatal(err) } known, knownWhy, err := list("known") if err != nil { t.Fatal(err) } baseShared, _, err := list(sharedPath) if err != nil { t.Fatal(err) } baseKnown, _, err := list(knownPath) if err != nil { t.Fatal(err) } for _, g := range append(Grown("shared", shared, sharedWhy, baseShared), Grown("known", known, knownWhy, baseKnown)...) { t.Error(g) } }