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

internal/cuetxtar: fix two inline runner bugs master

Fix two bugs in the inline test framework: 1. Generator (eqFillAttrStr): re-indenting a multiline expression added the indent prefix to blank lines, producing whitespace-only lines that violated CUE's multiline-string whitespace rule ("non-matching whitespace"). Fix: after re-indentation, strip all-whitespace lines back to empty. 2. isInlineMode: parser.ParseFile failure on a file with a parse error in a @test attribute body caused the file to be skipped entirely, yielding a misleading "archive has no @test directives" error. Fix: use parser.AllErrors for error-recovery parsing so @test directives are still detected in the partial AST. Also fix the stray tab on the blank line in the @test(eq, ...) body in export/issue2119.txtar that triggered bug 1. Add regression tests: - testdata/inline/eq_fill_multiline_blank.txtar (TestInlineUpdate, generator fix) - TestIsInlineModeParsedError in inline_test.go (isInlineMode fix) Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com> Change-Id: I91ef9020d7b065a177ed4813f4deb221d12d7951 Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235991 TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>


+82 -5
5 changed files