Issue 1585, S19: the strict parser, every manifest problem function and the judge's tables (192 declarations, about 5,200 lines) and their 244 tests leave; composition keeps its own refusals and the helpers it uses. The catalogue's tests decode the manifests they build. ParseManifest, ParseManifestWith, ParseManifestForInputs, CatalogueProblems and the rest are gone; mesh-delivery-indexer/judge holds them. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// The paths a module's tree is taken from are the union its artifacts name, cleaned and sorted, and only when every
|
|
// artifact names some (novox/hq ADR 0499 clause 2); a module with an artifact that names none, or with none at all,
|
|
// keeps its directory's tree.
|
|
func TestAModulesNamedPathsAreTheUnionWhenEveryArtifactNamesThem(t *testing.T) {
|
|
m := Manifest{Module: "a", Build: &Build{Artifacts: []Artifact{
|
|
{Name: "lib", Kind: ArtifactPackage, Paths: []string{"src/", "package.json"}},
|
|
{Name: "tools", Kind: ArtifactBundle, Paths: []string{"./src", "tools"}},
|
|
}}}
|
|
paths, every := m.NamedPaths()
|
|
if !every || strings.Join(paths, ",") != "package.json,src,tools" {
|
|
t.Fatalf("NamedPaths = %v, %v; want [package.json src tools], true", paths, every)
|
|
}
|
|
m.Build.Artifacts = append(m.Build.Artifacts, Artifact{Name: "img", Kind: ArtifactImage, From: "Dockerfile"})
|
|
if paths, every := m.NamedPaths(); every || paths != nil {
|
|
t.Fatalf("a module with an artifact naming no path gave %v, %v", paths, every)
|
|
}
|
|
if paths, every := (Manifest{Module: "b"}).NamedPaths(); every || paths != nil {
|
|
t.Fatalf("a module that builds nothing gave %v, %v", paths, every)
|
|
}
|
|
}
|