- Stubbing methods - Verifying calls and returns - Tests involving the file system
For example, when files need to be present for a function we are testing, it would be very cumbersome to create these files manually. Instead testthatsomemore offers helper functions to create a structured set of files:
test_dir <- create_test_files(list(dir1 = list('file1',
file2.r = 'print("Sample R code")'), file3.csv = "a,b,c\n1,2,3"))
with the return value being a test directory containing these structured files.
Additionally, create_test_files
has created an on.exit
trigger
in the calling environment that will unlink everything in this test directory.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.