Given a package, the code to be executed and a list of functions to capture, the function captures the selected functions from the package, then runs the specified code. It then generates tests from the captured information and using code coverage filters them against existing tests for the package. Those that increase the code coverage will be added to already existing testthat tests for the package.
1 2 3 | gen_from_patch(package.dir = ".", code, functions, filter = TRUE,
exclude_existing_tests = FALSE, build = TRUE, timed = FALSE, output,
verbose = testr_options("verbose"))
|
package.dir |
Name/path to the package, uses devtools notation |
code |
Function (with no arguments) whose code will be executed and its calls in the package captured. |
functions |
Functions from the package to be captured, if missing, all package functions will be captured (character vector) |
filter |
T if the generated tests should be filtered |
exclude_existing_tests |
If TRUE, existing tests will be ignored from the code coverage |
build |
T if the package will be built beforehand |
timed |
TRUE if the tests result depends on time, in which case the current date & time will be appended to the output_dir. |
output |
If used, specifies where should the tests be unfiltered tests be generated (if not specified, they will use a temp directory and clean it afterwards) |
verbose |
Prints additional information. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.