-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Since you are advocating for writing functions it is worth talking about the @examples tag in Roxygen blocks. These allow functional tests to be documented within the function man page and are a requirement for CRAN submission (interestingly testthat tests are not).
You can run all the examples with devtools::run_examples() and the examples all get run on RCMD check and they form a key part of the documentation of a function. If you build a pkgdown site all the results of the examples are run and shown in the site.
They are very useful for iterative testing whilst developing a function as they can be executed direct from the RStudio code editor as you are working on a function.
They don't show up as code coverage and can only run on exported functions from your package.