Mirror of https://github.com/cue-lang/cue cuelang.org
cue go

internal/cuetxtar: add out/errors.txt section master

Add a documentary out/errors.txt section to txtar tests. The section records all error messages (including incomplete errors) with [code] prefixes, serving as a change detector when error messages evolve. Behaviour: - Never auto-created; only populated when the section already exists in the archive. - CUE_UPDATE=1: updates the section content. - CUE_CHECK=1: fails if the section is stale. - Normal test run: silently ignores differences. The new cuetest.Check variable (CUE_CHECK=1) enables strict verification of doc sections and is designed to be extended to other checks (e.g. stats) in the future. PrintErrors in internal/cuetxtar/errors.go walks the *adt.Vertex tree and prints each error with its [code] prefix, including incomplete errors that adt.Validate omits by default. Inline tests write to out/errors.txt; golden-file tests write to out/<name>/errors.txt (e.g. out/evalalpha/errors.txt). 012_selecting.txtar is converted to inline mode as an example, with the out/errors.txt section populated. Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com> Change-Id: I6891f6bdfb1824b30c513fce2243f38a7f70e9ab Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1234629 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>


+197 -116
8 changed files