Write testdata to a file formatted for use with the testthat package.

write_testfile(
  testdata,
  func_name,
  filename = NULL,
  filepath = NULL,
  overwrite = FALSE
)

Arguments

testdata

tibble

func_name

charater. The name of the function being tested. Typically the name of the sheet.

filename

character (vector). The default is testsheet_<sheet>.R. The number of given filenames must match the length of testdata.

filepath

character. The defallt is the current working directory

overwrite

boolean. The default is FALSE.

Examples

ss <- testsheets_example("google sheets") testdata <- read_testsheet(ss, "sum")
#> Reading from "testsheets_example"
#> Range "'sum'"
write_testfile(testdata, "sum", filename="mycustomfile.R")
#> A file /Users/nicolebrewer/Repos/nicole-brewer-github/testsheets/docs/reference/mycustomfile.R already exists. Use the option `overwrite = TRUE` to overwrite it.