test_examples_as_testthat | R Documentation |
testthat
testsReads examples from Rd files and constructs testthat
-style tests.
testthat
expectations are built such that
test_examples_as_testthat(
package,
path,
...,
test_dir = file.path(tempdir(), "testex-tests"),
clean = TRUE,
overwrite = TRUE,
roxygenize = !is_r_cmd_check() && uses_roxygen2(path),
reporter = testthat::get_reporter()
)
package |
A package name whose examples should be tested |
path |
Optionally, a path to a source code directory to use. Will only
have an effect if parameter |
... |
Additional argument unused |
test_dir |
An option directory where test files should be written. Defaults to a temporary directory. |
clean |
Whether the |
overwrite |
Whether files should be overwritten if |
roxygenize |
Whether R documentation files should be re-written using
|
reporter |
A |
Each example expression is expected to run without error
Any testex
expectations are expected to pass
Generally, you won't need to use this function directly. Instead, it
is called by a file generated by use_testex_as_testthat()
which will add
any testex
example tests to your existing testthat
testing suite.
The result of testthat::source_file()
, after iterating over
generated test files.
It is assumed that this function is used within a testthat
run, when
the necessary packages are already installed and loaded.
# library(pkg.example)
path <- system.file("pkg.example", package = "testex")
test_examples_as_testthat(path = path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.