tests/testthat/test-docs.R

test_that("methods from multiple packages", {
  local_load_all("testS3")
  local_load_all("testExtendsS3")
  expect_snapshot(cat(methods_list("uni")))
})

test_that("S4 bullets print with no issues", {
  local_load_all("testS4")

  expect_snapshot(cat(methods_list("multi")))
})

test_that("S4 and S3 packages can intermingle", {
  local_load_all("testS4")
  local_load_all("testS3")

  expect_snapshot(cat(methods_list("uni", "testS4")))
  expect_snapshot(cat(methods_list("uni", "testS3")))
})

test_that("multiple methods with same rdname", {
  local_load_all("testS3")
  expect_snapshot(cat(methods_list("same_rd_name")))
})

test_that("self-links are suppressed", {
  local_load_all("testS3")
  expect_snapshot(cat(methods_list("self_link")))
})

test_that("methods_inline() produces comma-separated output", {
  local_load_all("testS3")
  local_load_all("testExtendsS3")
  expect_snapshot(cat(methods_inline("uni")))
})

test_that("no methods returns empty string", {
  expect_equal(methods_list("methods_list"), "")
  expect_equal(methods_inline("methods_list"), "")
})

test_that("nonexistant generic returns empty string", {
  expect_equal(methods_list("xyz"), "")
  expect_equal(methods_inline("xyz"), "")
})

Try the doclisting package in your browser

Any scripts or data that you put into this service are public.

doclisting documentation built on April 15, 2026, 5:07 p.m.