tests/testthat/test-check_as_cran.R

# WARNING - Generated by {fusen} from dev/flat_check_as_cran.Rmd: do not edit by hand

test_that("check_as_cran works", {
  path <- suppressWarnings(create_example_pkg())
  check_output <- tempfile("example")

  if (interactive()) {
    expect_error(check_as_cran(pkg = path, check_output = check_output), regexp = NA)
  } else {
    check_callr <- function(pkg, check_output) {
      library(checkhelper)
      check_as_cran(pkg = pkg, check_output = check_output)
    }

    # need to run in another env. inside check in check
    expect_error(callr::r(check_callr, args = list(pkg = path, check_output = check_output)), regexp = NA)
  }
  # check_as_cran(pkg = "/mnt/Data/github/ThinkR-open/attachment")
  # Check that env is clean - only manually
  # Sys.getenv("_R_CHECK_AUTOCONF_")
  unlink(check_output, recursive = TRUE)
})

Try the checkhelper package in your browser

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

checkhelper documentation built on May 29, 2024, 1:17 a.m.