Nothing
# Test case 1: Valid template name and directory creation
test_that("Valid template name and directory creation", {
# Define a temporary directory for testing
temp_dir <- tempdir()
on.exit(unlink(temp_dir, recursive = TRUE))
# Call use_template with a valid template name
use_template("advanced_preprocess_report", output_dir = temp_dir, overwrite = FALSE)
# Check if the directory was created
file <- file.path(gsub("\\\\", "/", temp_dir), "advanced_preprocess_report.Rmd")
expect_true(file.exists(file))
})
# Test case 2: Invalid template name
test_that("Invalid template name", {
# Define a temporary directory for testing
temp_dir <- tempdir()
on.exit(unlink(temp_dir, recursive = TRUE))
# Call use_template with an invalid template name
expect_error(use_template("non_existent_template", output_dir = temp_dir, overwrite = FALSE))
})
# Test case 3: Don't overwrite existing template directory
test_that("Don't overwrite existing template directory", {
# Define a temporary directory for testing
temp_dir <- tempdir()
on.exit(unlink(temp_dir, recursive = TRUE))
# Create a directory with the same name as the template
use_template("advanced_preprocess_report", output_dir = temp_dir)
# Call use_template without overwrite
expect_error(template_name("advanced_preprocess_report", output_dir = temp_dir, overwrite = FALSE))
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.