internal/cuetxtar: improve @test(eq) formatting and body validation
CUE_UPDATE=1 formatting improvements for @test(eq):
- Compact form: when a multi-line formatted value is < 20 characters it
is collapsed to a single line (e.g. "{a: 1}" instead of "{\n\ta: 1\n}").
- Indentation: multi-line values longer than 20 characters are re-indented
relative to the @test attribute's source line, matching the same trick
already used by @test(debug). This avoids both over-indentation and
mis-alignment when the attribute is deeply nested.
Body validation: report @test(...) field attributes inside an @test(eq, ...)
body that have no effect there. Only the directives that astCmp actively
processes (final, ignore, err, shareID, checkOrder) are permitted; anything
else is almost certainly misplaced and is now flagged as a test error.
Also fix a stale comment: the shareID version suffix example was using
":v3" which is optional; the updated wording makes clear that a bare
"shareID=name" is the default form.
Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I4e4922cb43d9bdd645541830e82b4ea43eb3dda4
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235353
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>