tests/testthat/test-formula_to_char.R

test_that("Character coercion error message works", {
  expect_error(set_contrasts(mtcars, carb = contr.poly),
               regexp = "Did you use = instead of ~")
})

test_that("Other error messages still display correctly", {
  expect_error(set_contrasts(mtcars, carb = contr.poly()),
               regexp = "is missing, with no default")
})

Try the contrastable package in your browser

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

contrastable documentation built on Oct. 1, 2024, 5:07 p.m.