View source: R/rpac_test_template.R
rpac_add_test | R Documentation |
rpac_test_template() creates a file with boilerplate code for running tests with testthat. rpac_add_test() appends a blurb for tests for a given function.
rpac_add_test(test_name = NULL, function_name = NULL,
path = "tests/testthat/", append = TRUE, open = TRUE)
rpac_test_template(test_name = NULL, pkg_name = NULL,
path = "tests/testthat")
test_name |
Name for test, inserted into 'test- name in rpac_test_template(). rpac_add_test() expects the same string to find the file and append to it. |
function_name |
Name of function that test will be used for. |
path |
Pass a path as string. Default is to place files for tests in the directory './tests/testthat/'. |
append |
Append text to an existing file. Default is TRUE. |
open |
Open the project in RStudio on creation. Default is TRUE. |
pkg_name |
package name as string. |
Run this for each file needed to create a test-testname.R file with a blurb. Files must be within tests/testthat/ or inst/tests and start with 'test' and end in '.R' for testthat to pick them up. There are many types of tests, see testthat::expect_.
Antonio J. Berlanga-Taylor <https://github.com/AntonioJBT/Rpacker>
<http://r-pkgs.had.co.nz/tests.html>,
<http://testthat.r-lib.org/articles/custom-expectation.html>,
use_test
.
## Not run:
rpac_test_template(test_name = 'rpack_test_template',
pkg_name = 'rpack',
path = 'tests/testthat/'
)
rpac_add_test(test_name = 'rpack_test_template',
function_name = 'function_to_test',
path = 'tests/testthat',
append = TRUE,
open = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.