This functions can be used in package development to keep your unit tests where your function definitions are. The code in expr
will be saved into a R file in the test directory. And can then be called by your testing framework. Files will be created and replaced on the fly.
1 2 3 4 | testInline(label, expr, file = paste0("test-", label, ".R"),
dir = getOption("testInline.directory", "tests/testthat"),
eval = interactive(), testFun = getOption("testInline.testFun", function()
devtools::test(filter = label)))
|
label |
label for tests. Used only as default in other arguments |
expr |
test code |
file |
character with name of file in which expr will be stored |
dir |
directory where you want your tests |
eval |
if you want to evaluate your testcode right away |
testFun |
how you test code is evaluated. Only relevant if called interactively |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.