Skip to content

test: increase Perl coverage with targeted gap tests#248

Merged
toddr merged 1 commit intomainfrom
koan.toddr.bot/increase-test-coverage
Apr 9, 2026
Merged

test: increase Perl coverage with targeted gap tests#248
toddr merged 1 commit intomainfrom
koan.toddr.bot/increase-test-coverage

Conversation

@toddr-bot
Copy link
Copy Markdown
Collaborator

@toddr-bot toddr-bot commented Apr 9, 2026

What

Adds t/coverage_gaps.t — 31 targeted tests exercising previously untested code paths identified via Devel::Cover analysis.

Why

Codecov was recently added (PR #247). Initial coverage showed several gaps in Perl-side code, particularly in style handlers, namespace methods without namespaces, Expat's direct parse methods, and security API validation.

How

Ran Devel::Cover locally, identified uncovered lines/branches/subs, and wrote focused tests for each gap. Key areas covered:

  • Debug/Stream styles: Processing instruction (Proc/PI) handlers — never tested before
  • Expat.pm: parsestring(), parsefile(), parsefile-reuse croak, namespace methods without Namespaces mode
  • ContentModel: MIXED type asString serialization
  • Parser.pm: parsefile() in list context, branch coverage to 100%
  • Objects style: Adjacent text concatenation (line 37)
  • Security APIs: Argument validation (undef → croak) for all 5 methods

Coverage improvement (statement %)

Module Before After
Expat.pm 88% 94%
Debug.pm 72% 96%
Stream.pm 86% 99%
Objects.pm 97% 100%
Parser.pm 94% 95%

Subroutine coverage reached 100% across all modules.

Testing

Full test suite passes (652 tests across 58 test files).

🤖 Generated with Claude Code


Quality Report

Changes: 1 file changed, 244 insertions(+)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Targets specific coverage gaps identified via Devel::Cover analysis:
- Debug/Stream Proc handlers (processing instructions)
- Expat parsestring() and parsefile() methods
- ContentModel MIXED asString serialization
- Namespace methods without Namespaces enabled
- Parser.pm parsefile in list context
- Objects style adjacent text concatenation
- Security API argument validation (undef croaks)

Key improvements: Expat.pm 88%→94% stmt, 93%→100% sub;
Debug.pm 72%→96%; Stream.pm 86%→99%; Objects.pm 97%→100%.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.71%. Comparing base (6f8684f) to head (d60dc99).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #248   +/-   ##
=======================================
  Coverage   72.71%   72.71%           
=======================================
  Files           1        1           
  Lines        1092     1092           
  Branches      342      342           
=======================================
  Hits          794      794           
  Misses         74       74           
  Partials      224      224           
Flag Coverage Δ
perl 72.71% <ø> (ø)
xs 72.71% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

@toddr toddr marked this pull request as ready for review April 9, 2026 21:45
@toddr toddr merged commit 4aa049b into main Apr 9, 2026
36 checks passed
@toddr toddr deleted the koan.toddr.bot/increase-test-coverage branch April 9, 2026 21:45
toddr-bot added a commit that referenced this pull request Apr 15, 2026
The following test files were added in recent PRs but not included in
MANIFEST, meaning they would be absent from the CPAN distribution tarball:

- t/coverage_gaps.t (PR #248)
- t/expat_xs_coverage.t (PR #249)
- t/parser_api.t (PR #244)
- t/stream_delimiter.t (PR #243)

Also extend MANIFEST.SKIP with standard exclusions for build artifacts
(blib/, *.o, *.so, *.bs, *.c), coverage data (cover_db/), and OS files
(.DS_Store) to prevent future regenerations from picking up stale files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants