Skip to content

test(utils): cover EncodeToken error path in H.MarshalXML - #4739

Open
c879873067877881111 wants to merge 1 commit into
gin-gonic:masterfrom
c879873067877881111:test/marshalxml-encodetoken-error
Open

test(utils): cover EncodeToken error path in H.MarshalXML#4739
c879873067877881111 wants to merge 1 commit into
gin-gonic:masterfrom
c879873067877881111:test/marshalxml-encodetoken-error

Conversation

@c879873067877881111

@c879873067877881111 c879873067877881111 commented Jul 19, 2026

Copy link
Copy Markdown
  • Open your pull request against the master branch.
  • All tests pass in available continuous integration systems (e.g., GitHub Actions).
  • Tests are added or modified as needed to cover code changes.

H.MarshalXML returns early when the opening e.EncodeToken(start) call
fails, but no test covered that error path.

Because xml.Encoder buffers its output, the underlying writer is not
called until the buffer flushes. The test writes an 8KB token first to
push the encoder into an error state, then calls MarshalXML and asserts
the write error is propagated.
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.39%. Comparing base (3dc1cd6) to head (3e6682d).
⚠️ Report is 292 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4739      +/-   ##
==========================================
- Coverage   99.21%   98.39%   -0.83%     
==========================================
  Files          42       48       +6     
  Lines        3182     3172      -10     
==========================================
- Hits         3157     3121      -36     
- Misses         17       42      +25     
- Partials        8        9       +1     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.37% <ø> (?)
-tags go_json 98.31% <ø> (?)
-tags nomsgpack 98.36% <ø> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.25 98.39% <ø> (?)
go-1.26 98.39% <ø> (?)
macos-latest 98.39% <ø> (-0.83%) ⬇️
ubuntu-latest 98.39% <ø> (-0.83%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant