add tests for lib/template funcmap helpers - #683
Merged
gianlucam76 merged 2 commits intoSep 18, 2026
Merged
Conversation
gianlucam76
previously approved these changes
Sep 15, 2026
gianlucam76
left a comment
Member
There was a problem hiding this comment.
Thank you for pushing this. LGTM
Member
|
hi @magic-peach thank you for pushing this. Looks good. can you please push to "main" branch instead of "dev"? then we can merge it |
toYaml, fromYaml, fromYamlArray, toToml, fromToml, toJson, fromJson and fromJsonArray had no coverage, including the error paths where a parse failure gets folded into the returned value instead of returned as a Go error, since these are meant to be called from inside a template. Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
magic-peach
force-pushed
the
test/template-funcmap-coverage
branch
from
September 15, 2026 13:57
bbca561 to
c47f8f0
Compare
magic-peach
dismissed
gianlucam76’s stale review
September 15, 2026 13:57
The base branch was changed.
Contributor
Author
|
@gianlucam76 Done, retargeted to main. |
Member
|
can you please fix the linting issues? thanks |
Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
gianlucam76
approved these changes
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This repo has no PR template, so this is a plain factual description.
What changed
Added tests for the 8 template helper functions in ExtraFuncMap() in lib/template/funcmap.go: toYaml, fromYaml, fromYamlArray, toToml, fromToml, toJson, fromJson and fromJsonArray.
Why
None of these had any test coverage, including the error paths where a parse failure gets folded into the returned value instead of returned as a Go error, which matters since these are meant to be called from inside a template where a Go error return isn't available.
Testing
go build ./..., go vet ./lib/template/... and go test ./lib/template/... all pass, 12/12 specs.