Skip to content

chore: close coverage gaps to 100% (RURL-ptuqbsld)#40

Merged
bart-turczynski merged 1 commit into
mainfrom
chore/coverage-100-RURL-ptuqbsld
Jun 20, 2026
Merged

chore: close coverage gaps to 100% (RURL-ptuqbsld)#40
bart-turczynski merged 1 commit into
mainfrom
chore/coverage-100-RURL-ptuqbsld

Conversation

@bart-turczynski

Copy link
Copy Markdown
Owner

Closes RURL-ptuqbsld.

covr::package_coverage() was at 99.4% with seven untested error/fallback
branches. This takes it back to 100%.

What was wrong

The existing test-rurl-coverage.R test "internal parse handles NA regex
results" stubbed stri_detect_regex to return NA, but the comparison
literal was over-escaped (\\/\\/ vs the code's \/\/), so identical()
never matched and the has_scheme_slashes NA-coercion branch stayed
uncovered. Fixed the literal.

Changes

  • Fix the over-escaped regex literal so the stub fires (covers
    parse-phases.R scheme-slash NA guard).
  • New tests for reachable defensive guards:
    • .punycode_to_unicode("")""
    • .host_is_ace() NA / empty / non-scalar inputs
    • .cache_enabled() unknown cache name
    • derive_parse_status() NA host_has_dot fallback (via a
      stri_detect_fixed stub, matching the existing NA-coercion idiom)
  • # nocov on the two genuinely unreachable www-prefix
    regex-capture else-fallbacks (the preceding detection guarantees the
    (.*) group always matches, so the else is dead) — with justifying
    comments.

Verification

  • covr::package_coverage()100%, no uncovered lines.
  • devtools::test() → all pass.
  • lintr clean on changed files.

🤖 Generated with Claude Code

Add targeted tests for the reachable defensive guards and mark the
genuinely unreachable branches # nocov, taking covr to 100%.

- Fix an over-escaped regex literal in the existing scheme-slash NA test
  so the stub actually matches the code's pattern (covers parse-phases.R
  has_scheme_slashes NA coercion).
- New direct tests for .punycode_to_unicode(""), .host_is_ace() guards,
  .cache_enabled() unknown name, and the derive_parse_status() NA
  host-has-dot fallback (via a stri_detect_fixed stub).
- Mark the two www-prefix regex-capture else-fallbacks # nocov; the
  preceding detection guarantees the capture group always matches.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bart-turczynski bart-turczynski merged commit 7d24dd3 into main Jun 20, 2026
2 checks passed
@bart-turczynski bart-turczynski deleted the chore/coverage-100-RURL-ptuqbsld branch June 20, 2026 21:03
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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