Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions R/object-from-call.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ s7_class_name <- function(cls, block) {
unlist(lapply(cls$classes, s7_class_name, block = block))
} else if (inherits(cls, "S7_S3_class")) {
cls$class
} else if (inherits(cls, "S7_any")) {
"any"
} else if (inherits(cls, "S7_missing")) {
"missing"
} else {
warn_roxy_block(block, "Unknown S7 class type")
paste0(deparse(cls), collapse = " ")
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-object-from-call.R
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ test_that("S7 method on S3 generic includes package prefix in class name", {
expect_equal(obj$value$generic, "print")
})

test_that("S7 method with special classes any and missing", {
skip_unless_r(">= 4.3.0")
block <- roxy_block(tags = list(), file = "test.R", line = 1, call = quote(x))
expect_equal(s7_class_name(S7::class_any, block), "any")
expect_equal(s7_class_name(S7::class_missing, block), "missing")
})

test_that("S7 method with unknown class type warns", {
skip_unless_r(">= 4.3.0")
block <- roxy_block(tags = list(), file = "test.R", line = 1, call = quote(x))
Expand Down
Loading