Skip to content

Commit

Permalink
Updates for expect_vector() (#2018)
Browse files Browse the repository at this point in the history
* Check that {vctrs} is installed.
* Remove version check from examples
* Use `@examplesIf`
  • Loading branch information
hadley authored Nov 6, 2024
1 parent fc0025c commit 81c3655
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions R/expect-vector.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
#' size-0 (empty) generalised vector.
#' @param size (Optional) Size to check for.
#' @export
#' @examples
#' if (requireNamespace("vctrs") && packageVersion("vctrs") > "0.1.0.9002") {
#' @examplesIf requireNamespace("vctrs")
#' expect_vector(1:10, ptype = integer(), size = 10)
#' show_failure(expect_vector(1:10, ptype = integer(), size = 5))
#' show_failure(expect_vector(1:10, ptype = character(), size = 5))
#' }
expect_vector <- function(object, ptype = NULL, size = NULL) {
check_installed("vctrs")
act <- quasi_label(enquo(object), arg = "object")

message <- NULL
Expand Down
4 changes: 2 additions & 2 deletions man/expect_vector.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81c3655

Please sign in to comment.