Skip to content

Commit

Permalink
Update standalone-checks.R
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Feb 7, 2024
1 parent 8d5f14c commit d935f3c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions R/standalone-checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ check_not_missing <- function(x,
#' @keywords internal
#' @noRd
check_length <- function(x, length,
message = "The {.arg {arg_name}} argument must be length {.val {length}}.",
message =
ifelse(
allow_empty,
"The {.arg {arg_name}} argument must be length {.val {length}} or empty.",
"The {.arg {arg_name}} argument must be length {.val {length}}."
),
allow_empty = FALSE,
arg_name = rlang::caller_arg(x), call = parent.frame()) {
# if empty, skip test
Expand All @@ -108,7 +113,12 @@ check_length <- function(x, length,
#' @keywords internal
#' @noRd
check_scalar <- function(x,
message = "The {.arg {arg_name}} argument must be length {.val {length}}.",
message =
ifelse(
allow_empty,
"The {.arg {arg_name}} argument must be length {.val {length}} or empty.",
"The {.arg {arg_name}} argument must be length {.val {length}}."
),
allow_empty = FALSE,
arg_name = rlang::caller_arg(x), call = parent.frame()) {
check_length(
Expand Down

0 comments on commit d935f3c

Please sign in to comment.