tests/testthat/test-short.R

# library(testthat); library(workflowHelper); library(remake)
context("short")
source("utils.R")

test_that("Short workflows without output stage can run.", {
  testwd("short-ok")
  sources = strings(code.R)
  datasets = commands(poisson100 = poisson_dataset(n = 100))
  plan_workflow(sources, datasets = datasets)
  path = system.file("example", "code.R", package = "workflowHelper")
  write(readLines(path), "code.R")
  remake::make(verbose = F)
  expect_equal(recallable(), "poisson100")
  expect_equal(dim(recall("poisson100")), c(100, 2))
  tmp = clean_example_workflowHelper(T)

  analyses = commands(linear = linear_analysis(..dataset..))
  plan_workflow(sources, datasets = datasets, analyses = analyses)
  path = system.file("example", "code.R", package = "workflowHelper")
  write(readLines(path), "code.R")
  remake::make(verbose = F)
  expect_equal(recallable(), c("poisson100", "poisson100_linear"))
  expect_equal(dim(recall("poisson100")), c(100, 2))
  expect_equal(class(recall("poisson100_linear")), "lm")
  testrm()
})
wlandau/workflowHelper documentation built on May 4, 2019, 8:45 a.m.