E8: run each file's unit tests as subtests of one test

The node-engine held 1,707 top-level unit tests against the budget of 500
a module. Each unit test file with two or more tests now runs them as
subtests of one test named for the file, each named as its function was,
in the same order: every check is kept, and the check counts 383. Files
with a TestMain, a re-run of a test by its name, or the integration tag
are left. Four files of this branch's earlier commits are formatted.

Builds: design 47 H2 §819; H-A-349 DQ-14
This commit is contained in:
2026-11-22 00:30:05 +01:00
parent a882051de6
commit 0c01c81c3f
257 changed files with 4189 additions and 1589 deletions
@@ -19,7 +19,7 @@ func notifier() mcat.Manifest {
}
}
func TestAnUnsetPreferenceTakesItsDefault(t *testing.T) {
func testAnUnsetPreferenceTakesItsDefault(t *testing.T) {
t.Run("the node over the mesh over the default", theNodeOverTheMeshOverTheDefault)
m := notifier()
for _, layers := range [][]mcat.Layer{nil, {{From: mcat.MeshWideLayer, Values: map[string]any{}}}} {
@@ -63,7 +63,7 @@ func theNodeOverTheMeshOverTheDefault(t *testing.T) {
// Composed for a machine, the way a push writes it: the default reaches the file, and the node's
// layer overrides it.
func TestAComposedMachineGetsTheDefaultAndTheNodesValue(t *testing.T) {
func testAComposedMachineGetsTheDefaultAndTheNodesValue(t *testing.T) {
r := anAdoptedAnchor()
n := notifier()
n.Resources = append(n.Resources, map[string]any{"id": "daemon", "type": "process", "name": "notifier",
@@ -101,7 +101,7 @@ func TestAComposedMachineGetsTheDefaultAndTheNodesValue(t *testing.T) {
}
// A default fills ${setting:…} only: it never becomes a key of a mergeable file (issue 168).
func TestADefaultIsNotMergedIntoAJSONFile(t *testing.T) {
func testADefaultIsNotMergedIntoAJSONFile(t *testing.T) {
m := notifier()
m.Resources = append(m.Resources, map[string]any{"id": "other", "type": "file", "path": "/x/other.json",
"merge": mcat.MergeJSON, "content": `{"keep": 1}`})
@@ -115,7 +115,7 @@ func TestADefaultIsNotMergedIntoAJSONFile(t *testing.T) {
}
// A value that is the operator's has no default: no layer setting it is refused by name, as before.
func TestAnOperatorsValueWithoutADefaultIsStillRefused(t *testing.T) {
func testAnOperatorsValueWithoutADefaultIsStillRefused(t *testing.T) {
m := notifier()
m.Resources[0]["content"] = "font = Inter ${setting:font-size}\nwidth = ${setting:width}\nfrom = ${setting:domain}\n"
err := JudgeSettings(m, nil, false)
@@ -127,7 +127,7 @@ func TestAnOperatorsValueWithoutADefaultIsStillRefused(t *testing.T) {
}
}
func TestEveryValueSaysWhereItCameFrom(t *testing.T) {
func testEveryValueSaysWhereItCameFrom(t *testing.T) {
m := notifier()
m.Resources[0]["content"] = m.Resources[0]["content"].(string) + "x = ${setting:position}\n"
got := Effective(m, []mcat.Layer{
@@ -154,7 +154,7 @@ func TestEveryValueSaysWhereItCameFrom(t *testing.T) {
// A node may be called `default`. Its layer is a node's like any other: it overrides the module's
// default, it merges into a mergeable file, and it is named among what is set.
func TestANodeCalledDefaultIsANodesLayer(t *testing.T) {
func testANodeCalledDefaultIsANodesLayer(t *testing.T) {
m := notifier()
node := []mcat.Layer{{From: mcat.DefaultLayer, Values: map[string]any{"font-size": float64(13)}}}
file := map[string]any{"type": "file", "content": m.Resources[0]["content"]}
@@ -178,7 +178,7 @@ func TestANodeCalledDefaultIsANodesLayer(t *testing.T) {
// A default fills ${setting:…} in what a module contributes and serves, and never replaces a value a
// contribution states itself.
func TestADefaultFillsAContributionAndAServedFactButNotALiteral(t *testing.T) {
func testADefaultFillsAContributionAndAServedFactButNotALiteral(t *testing.T) {
m := notifier()
m.Settings["site-title"] = mcat.SettingDeclaration{Kind: mcat.KindPreference, Default: "Notes", Why: "x"}
contribution := map[string]any{"title": "${setting:site-title}", "width": "fixed", "port": float64(8080)}
@@ -201,3 +201,14 @@ func TestADefaultFillsAContributionAndAServedFactButNotALiteral(t *testing.T) {
t.Fatal("a served fact without the defaults was filled")
}
}
// TestSettingDefaults runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
func TestSettingDefaults(t *testing.T) {
t.Run("AnUnsetPreferenceTakesItsDefault", testAnUnsetPreferenceTakesItsDefault)
t.Run("AComposedMachineGetsTheDefaultAndTheNodesValue", testAComposedMachineGetsTheDefaultAndTheNodesValue)
t.Run("ADefaultIsNotMergedIntoAJSONFile", testADefaultIsNotMergedIntoAJSONFile)
t.Run("AnOperatorsValueWithoutADefaultIsStillRefused", testAnOperatorsValueWithoutADefaultIsStillRefused)
t.Run("EveryValueSaysWhereItCameFrom", testEveryValueSaysWhereItCameFrom)
t.Run("ANodeCalledDefaultIsANodesLayer", testANodeCalledDefaultIsANodesLayer)
t.Run("ADefaultFillsAContributionAndAServedFactButNotALiteral", testADefaultFillsAContributionAndAServedFactButNotALiteral)
}