tests/testthat/test-read-plan.R

context("read_install_plan")

test_that("can parse install plan", {
  skip_on_cran()

  withr::local_options(list(repos = "https://cloud.r-project.org/"))

  lib <- tempfile()
  on.exit(unlink(lib, recursive = TRUE), add = TRUE)
  plan_file <- tempfile()
  on.exit(unlink(plan_file, recursive = TRUE), add = TRUE)

  rem <- pkgdepends::remotes()$new("processx", library = lib)
  rem$solve()
  rem$export_install_plan(plan_file)

  plan <- read_install_plan(plan_file)
  expect_s3_class(plan, "data.frame")
  cols <- c(
    "ref", "package", "version", "type", "binary", "needscompilation",
    "metadata", "sources", "target")
  for (c in cols) expect_true(c %in% colnames(plan), info = c)
})
gaborcsardi/installlite documentation built on May 22, 2019, 5:33 p.m.