diff --git a/DESCRIPTION b/DESCRIPTION index 56ea5bd..00c7946 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,7 @@ Depends: Imports: methods Suggests: - pkgload, + pkgload (>= 1.5.2), S7, testthat (>= 3.0.0) Config/Needs/website: tidyverse/tidytemplate diff --git a/tests/testthat/_snaps/find-s7.md b/tests/testthat/_snaps/find-s7.md index d205b23..11e5d41 100644 --- a/tests/testthat/_snaps/find-s7.md +++ b/tests/testthat/_snaps/find-s7.md @@ -6,6 +6,7 @@ \itemize{ \item \code{\link[=uni-character-method]{character}} \item \code{integer} + \item \code{\link[=uni-testS7-foo-method]{testS7::foo}} } # S7 multi-dispatch methods_list output diff --git a/tests/testthat/test-find-s7.R b/tests/testthat/test-find-s7.R index 382f202..5d8ea52 100644 --- a/tests/testthat/test-find-s7.R +++ b/tests/testthat/test-find-s7.R @@ -1,9 +1,12 @@ test_that("methods_find finds S7 methods", { local_load_all("testS7") result <- methods_find("uni") - expect_equal(result$class, c("character", "integer")) - expect_equal(result$package, rep("testS7", 2)) - expect_equal(result$topic, c("uni-character-method", "uni")) + expect_equal(result$class, c("character", "integer", "testS7::foo")) + expect_equal(result$package, rep("testS7", 3)) + expect_equal( + result$topic, + c("uni-character-method", "uni", "uni-testS7-foo-method") + ) }) test_that("methods_find finds S7 multi-dispatch methods", { diff --git a/tests/testthat/testS7/NAMESPACE b/tests/testthat/testS7/NAMESPACE index 5fea7b1..36fd1fd 100644 --- a/tests/testthat/testS7/NAMESPACE +++ b/tests/testthat/testS7/NAMESPACE @@ -1,4 +1,5 @@ # Generated by roxygen2: do not edit by hand +export(foo) export(multi) export(uni) diff --git a/tests/testthat/testS7/R/uni.R b/tests/testthat/testS7/R/uni.R index c5f19f9..673a2fe 100644 --- a/tests/testthat/testS7/R/uni.R +++ b/tests/testthat/testS7/R/uni.R @@ -9,3 +9,10 @@ S7::method(uni, S7::class_integer) <- function(x, ...) x #' S7 character method S7::method(uni, S7::class_character) <- function(x, ...) x + +#' An S7 class +#' @export +foo <- S7::new_class("foo", package = "testS7") + +#' S7 foo method +S7::method(uni, foo) <- function(x, ...) x diff --git a/tests/testthat/testS7/man/foo.Rd b/tests/testthat/testS7/man/foo.Rd new file mode 100644 index 0000000..457c1af --- /dev/null +++ b/tests/testthat/testS7/man/foo.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/uni.R +\name{foo} +\alias{foo} +\title{An S7 class} +\usage{ +foo() +} +\description{ +An S7 class +} diff --git a/tests/testthat/testS7/man/uni-testS7-foo-method.Rd b/tests/testthat/testS7/man/uni-testS7-foo-method.Rd new file mode 100644 index 0000000..49d421d --- /dev/null +++ b/tests/testthat/testS7/man/uni-testS7-foo-method.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/uni.R +\name{uni,testS7::foo-method} +\alias{uni,testS7::foo-method} +\title{S7 foo method} +\usage{ +## S7 method for class +uni(x, ...) +} +\description{ +S7 foo method +}