tests/testthat/test-utils.R

context("utils")
test_that("require_namespaces", {

  if ("survival" %in% loadedNamespaces()) unloadNamespace("survival")

  expect_false("package:survival" %in% search())

  suppressMessages(require_namespaces(c("survival")))

  expect_false("package:survival" %in% search())

  expect_false(is.null(getNamespace("survival")))

  expect_error(
    suppressWarnings(suppressMessages(
      require_namespaces("DOES_NOT_EXIST_qweqweqweqwe")
    ))
  )
})

Try the GGally package in your browser

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

GGally documentation built on May 18, 2018, 1:08 a.m.