Skip to content

Commit

Permalink
Call is_what() also for objects with length > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
hsonne committed Aug 12, 2023
1 parent 5df569e commit e835c3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/analyse.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type_info <- function(x, as_character = FALSE)
class = class_x,
length = length(x),
text = shorten(paste0("[", seq_along(text), "]", text, collapse = "")),
is = if (length(x) == 1L) is_what(x),
is = is_what(x),
n_modes = length(mode_x),
n_classes = length(class_x)
)
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-function-get_elements_by_type.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ test_that("get_elements_by_type() works", {
result <- f(x)

expect_type(result, "list")
expect_true("language|call|<-|3|" %in% names(result))

name <- "language|call|<-|3|call,language,recursive"
expect_true(name %in% names(result))
})

0 comments on commit e835c3b

Please sign in to comment.