Test that a manifest refuses every key and shape it does not define, that a table under a shipped table loads from a data path, that an omitted parent fails the first reach, and pin New's allocations

This commit is contained in:
2026-10-09 19:36:27 +02:00
committed by Lillem4n
parent c783d4af23
commit 3c1af91433
2 changed files with 68 additions and 29 deletions
+13
View File
@@ -174,3 +174,16 @@ func BenchmarkWideTokens100(b *testing.B) {
func BenchmarkWideTokens500(b *testing.B) {
benchPath(b, tmpData(b, "wide", wideTokenJSON(500)), "wide")
}
// New decodes the shipped manifest and loads nothing else.
func TestNoNewAllocRegression(t *testing.T) {
const base = 2501.0
allocs := testing.AllocsPerRun(100, func() {
if _, err := New(WithSeed(1)); err != nil {
t.Fatal(err)
}
})
if allocs > base*1.10 {
t.Errorf("New: %.1f allocs/op regressed past %.1f (baseline %.1f + 10%%); bump the baseline only as a deliberate change", allocs, base*1.10, base)
}
}