This is my test file:
## test-foo_files.R
## Setup
dir.create("temp")
file.create("temp/file1.R")
file.create("temp/file2.R")
## test
test_that("List all R files works", {
expect_equal(list_R_scripts("temp"), c("file1.R", "file2.R"))
})
## Cleaning
unlink("temp")
How to make the cleaning part running even if the test fails?