Custom expectations

  • expect_usethis_error() checks that an error has the “usethis_error” class.
expect_usethis_error <- function(...) {
  expect_error(..., class = "usethis_error")
}
  • expect_proj_file() is a simple wrapper around file_exists() that searches for the file in the current project.
expect_proj_file <- function(...) {
  expect_true(file_exists(proj_path(...)))
}