Bug report:
In schema/example_test.go, the validate(t, examples) function iterates over examples extracted from docs/config.md. For each example it checks example.Err (the error from parsing that specific example block), but when reporting the failure it calls t.Error(err) instead of t.Error(example.Err).
The err variable in that scope is the result of extractExamples(...) from earlier in the function. By the time the loop runs, extractExamples has already succeeded, so err is nil. Calling t.Error(nil) is a no-op, which means example parsing failures pass the test instead of failing it.
Expected behavior:
If any documented example in docs/config.md cannot be parsed, TestValidateConfigExample should fail with that example's parsing error so the broken documentation can be caught in CI.
How to reproduce it:
- Clone the repo at current
main.
- Temporarily corrupt one of the JSON examples inside
json ... blocks in docs/config.md (e.g. remove a closing brace).
- Run
go test ./schema -run TestValidateConfigExample -v.
- Observe that the test still passes despite the malformed example, because the error path uses the wrong variable.
Environment:
- Model Spec version: v0.0.7 (also present in
main at commit c971699)
- OS: any (logic bug, platform-independent)
- Kernel (e.g.
uname -a): n/a
- Others: Go 1.23.1 toolchain (per
go.mod)
Bug report:
In
schema/example_test.go, thevalidate(t, examples)function iterates over examples extracted fromdocs/config.md. For each example it checksexample.Err(the error from parsing that specific example block), but when reporting the failure it callst.Error(err)instead oft.Error(example.Err).The
errvariable in that scope is the result ofextractExamples(...)from earlier in the function. By the time the loop runs,extractExampleshas already succeeded, soerrisnil. Callingt.Error(nil)is a no-op, which means example parsing failures pass the test instead of failing it.Expected behavior:
If any documented example in
docs/config.mdcannot be parsed,TestValidateConfigExampleshould fail with that example's parsing error so the broken documentation can be caught in CI.How to reproduce it:
main.json ...blocks indocs/config.md(e.g. remove a closing brace).go test ./schema -run TestValidateConfigExample -v.Environment:
mainat commit c971699)uname -a): n/ago.mod)