Skip to content

Add test coverage for condformat_render.R and theme_kable.R - #59

Merged
zeehio merged 1 commit into
mainfrom
claude/coverage-render-kable
Jul 10, 2026
Merged

Add test coverage for condformat_render.R and theme_kable.R#59
zeehio merged 1 commit into
mainfrom
claude/coverage-render-kable

Conversation

@zeehio

@zeehio zeehio commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

theme_kable.R had no dedicated test file at all (86% coverage, exercised only incidentally). New test-theme-kable.R covers:

  • Wrapping a plain data.frame into a condformat_tbl.
  • Argument accumulation across chained theme_kable() calls.
  • Explicitly resetting an argument to NULL (a distinct code path from omitting it: kable_args[paramname] <- list(NULL)).

condformat_render.R's knit_print.condformat_tbl() (89% coverage): added a test for the paginated-TRUE HTML branch, which returns an htmlwidget via condformat2widget() rather than plain HTML — previously untested.

While looking at the use_longtable default-TRUE branch (adding the longtable LaTeX dependency), I found a test-isolation bug in test-render-latex.R: "condformat2latex does not use longtable if disabled" set knitr::opts_current$set(longtable = FALSE) without ever resetting it, so the following "knitr latex returns LaTeX code" test silently inherited longtable = FALSE and never actually exercised the default (TRUE) longtable path — meaning this branch was untested despite looking covered. Added on.exit cleanup to that test and a new one asserting the "longtable" LaTeX dependency is added by default.

No production code changes.

Test plan

  • rcmdcheck::rcmdcheck(): 0 errors, 0 warnings, only the pre-existing environment-only .claude NOTE.
  • Full test suite passes.

Generated by Claude Code

theme_kable.R had no dedicated test file at all. New test-theme-kable.R
covers: wrapping a plain data.frame into a condformat_tbl, argument
accumulation across chained calls, and explicitly resetting an argument
to NULL (kable_args[paramname] <- list(NULL), distinct from removing it).

condformat_render.R's knit_print.condformat_tbl(): added a test for the
paginated-TRUE HTML branch (returns an htmlwidget via condformat2widget()
rather than plain HTML).

Also fixed a test-isolation bug in test-render-latex.R: "condformat2latex
does not use longtable if disabled" set knitr::opts_current$set(longtable
= FALSE) without ever resetting it, so the following "knitr latex returns
LaTeX code" test silently inherited longtable = FALSE and never actually
exercised the default (TRUE) longtable path this test suite otherwise
never covered. Added on.exit cleanup and a new test asserting the
"longtable" LaTeX dependency is added by default.

No production code changes.
@zeehio
zeehio force-pushed the claude/coverage-render-kable branch from e490b9c to 63b1cc3 Compare July 10, 2026 08:07
@zeehio
zeehio merged commit ff28e8e into main Jul 10, 2026
7 checks passed
@zeehio
zeehio deleted the claude/coverage-render-kable branch July 10, 2026 08:14
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