check_pick(
...,
pick = NULL,
min_pick = NULL,
max_pick = NULL,
.names = get_names(...)
)
assert_pick(
...,
pick = NULL,
min_pick = NULL,
max_pick = NULL,
.names = get_names(...)
)
test_pick(
...,
pick = NULL,
min_pick = NULL,
max_pick = NULL,
.names = get_names(...)
)
Objects to compare.
(optional) an integer number indicating the expected number of
arguments to pick (default: NULL
) (default: 1
).
(optional) an integer number indicating the minimum number of
arguments to pick (default: NULL
).
(optional) an integer number indicating the maximum number of
arguments to pick (default: NULL
).
(optional) a character vector
containing names for each object in ...
(default:
prettycheck:::get_names(...)
). This argument is used internally and
should not be set by the user.
test_*
: TRUE
if it passes the test; FALSE
otherwise.
check_*
: TRUE
if it passes the test; a string with a message otherwise.
assertion_*
: The same input as invisible if it passes the
test; an error message otherwise.
expect_*
: The same input as invisible if it passes the
test; an error message otherwise.
x <- 1; y <- NULL
test_pick(x, y, pick = 1)
#> [1] TRUE
#> [1] TRUE # Expected
x <- 1; y <- NULL; z <- NULL
check_pick(x, y, z, pick = 2) |> cli::cli_alert_warning()
#> ! You must pick 2 of the x, y and z arguments.
#> ! You must pick 2 of the x, y and z arguments. # Expected
x <- 1; y <- NULL
check_pick(x, y, min_pick = 2) |> cli::cli_alert_warning()
#> ! You must assign the x and y arguments.
#> ! You must assign the x and y arguments. # Expected
x <- 1; y <- NULL; z <- NULL
check_pick(x, y, z, min_pick = 2) |> cli::cli_alert_warning()
#> ! You must pick 2 or more of the x, y and z arguments.
#> ! You must pick 2 or more of the x, y and z arguments. # Expected
x <- 1; y <- 1; z <- NULL
check_pick(x, y, z, max_pick = 1) |> cli::cli_alert_warning()
#> ! You must pick 1 or less of the x, y and z arguments.
#> ! You must pick 1 or less of the x, y and z arguments. # Expected