-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The following (minimised) test fails:
celfmt -agent -i src.cel
! stderr .
cmp stdout want.txt
-- src.cel --
program: |-
{}
fields: "{{toxic_when_quoted}}"
-- want.txt --
program: |-
{}
fields: "{{toxic_when_quoted}}"
--- FAIL: TestScripts (0.00s)
--- FAIL: TestScripts/bug (0.05s)
testscript.go:584: > celfmt -agent -i src.cel
[stderr]
2025/07/16 14:48:21 yaml: line 3: found unexpected end of stream
[exit status 1]
FAIL: testdata/bug.txt:1: unexpected command failure
If the "{{toxic_when_quoted}}" is replaced with {{toxic_when_quoted}} it does not fail. Nor does it fail if the fields object is placed above program.
This happens in *visitor.VisitContent because the s.Value ends at the " prior to the template snippet because we are assuming (incorrectly) that the remainder of the text of the value is valid YAML (which it is not in this case).
I'm not sure what the approach to fixing this is. The work around is to not make source that looks like this.
Metadata
Metadata
Assignees
Labels
No labels