Inline tests withroxygen2usingtestthatortinytest.In addition, there are a few roclets that aim at catching commondocumentation issues during the development cycle.
See demo package using this atroxytestdemo.
To build and install from Github run this command from withinR:
remotes::install_github("mikldk/roxytest", build_opts = c("--no-resave-data", "--no-manual"))You can also install the package without vignettes if needed asfollows:
remotes::install_github("mikldk/roxytest")Please refer to thisREADME as well as the includedmanual pages as well as the vignette, all also available online athttps://mikldk.github.io/roxytest/.
There are a number of roclets included:
testthat_roclettinytest_rocletparam_rocletreturn_rocletexamples_rocletPlease refer to the “Introduction”vignette for details on these.
To use the package in your own package you do not need to add anyadditional dependencies in your package’sDESCRIPTION file.Simply add the following lines to your package’sDESCRIPTION file (or any other of the roclets mentionedabove):
Roxygen: list(roclets = c("namespace", "rd", "roxytest::testthat_roclet"))In RStudio,CTRL+SHIFT+D/CMD+SHIFT+D optiondoes not rundevtools::document() but onlydevtools::document(roclets=c('rd', 'collate', 'namespace'))(possibly with fewer depending on the project options, but notnone).
Instead, you can usedevtools’document()addin (seee.g. Rstudiodocumentation), and override the keyboard shortcut.