Skip to content

Commit

Permalink
Fix #435
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Jul 11, 2024
1 parent 4071bec commit 7038b64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ escape_xml <- function(x, replacement = c("&amp;", "&quot;", "&lt;", "&gt;", "&a
if (isFALSE(length(file) == 1) && single_only) {
stop("Invalid `file` argument: `file` must be single", call. = FALSE)
}
if (any(is.na(file))) {
stop("Invalid `file` argument: `file` must not be NA", call. = FALSE)
}
invisible(NULL)
}

Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test_check_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ test_that(".check_file", {
expect_error(.check_file(data))
expect_error(.check_file(iris))
expect_error(.check_file(c("a.csv", "b.csv")))
expect_error(.check_file(NA))
expect_error(.check_file(NA_character_))
expect_error(.check_file(c(NA, "a.csv")))
expect_error(.check_file(c(NA_character_, "a.csv")))
expect_error(.check_file("a.csv"), NA)
expect_error(.check_file(), NA)
## single_only FALSE
Expand Down

0 comments on commit 7038b64

Please sign in to comment.