tests/testthat/test_checkFormula.R

context("checkFormula")

test_that("checkFormula", {
  f = ~ x
  expect_succ_all(Formula, f)
  expect_fail_all(Formula, 1)

  f = y ~ x + z
  expect_true(checkFormula(f))

  f = y ~ x:z + I(a)
  expect_true(checkFormula(f))

  expect_true(checkFormula(NULL, null.ok = TRUE))
  expect_error(assertFormula(1, "formula"))
})

Try the checkmate package in your browser

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

checkmate documentation built on July 4, 2019, 5:12 p.m.