tests/testthat/test-rd-backref.R

test_that("Source reference is included as comment", {
  out <- roc_proc_text(rd_roclet(), "
    #' @name a
    #' @title a
    #' @docType package
    NULL")[[1]]

  expect_match(out$get_rd("backref"), "^% Please edit documentation in ")
})

test_that("Explicit @backref is included as comment", {
  out <- roc_proc_text(rd_roclet(), "
    #' @name a
    #' @title a
    #' @backref back/ref.file
    #' @backref root.file
    #' @docType package
    NULL")[[1]]

  expect_equal(out$get_value("backref"), c("back/ref.file", "root.file"))
})

Try the roxygen2 package in your browser

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

roxygen2 documentation built on Sept. 8, 2021, 9:08 a.m.