tests/testthat/test-is_package.R

context("test-is_package")

test_that("catches packages", {
  expect_true(is_package(quote(library(tidycode))))
  expect_true(all(is_package(c(quote(library(tidycode)),
                               quote(library(matahari)))))
  )
  expect_true(is_package("library(tidycode)"))
  expect_false(is_package("library"))
  expect_false(is_package(quote(lm(mpg ~ cyl, mtcars))))
  expect_false(is_package(quote(lm(library ~ chicken))))
  expect_false(is_package(1))
})

Try the tidycode package in your browser

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

tidycode documentation built on Dec. 11, 2019, 1:08 a.m.