tests/testthat/test-key-slope.R

test_that("key_slope does not handle character input", {
  expect_error(key_slope(heights, "height_cm ~ year"))
})

test_that("key_slope does not fail", {
  expect_s3_class(key_slope(heights, height_cm ~ year), "tbl_df")
})

test_that("key_slope fails when given non-formula", {
  expect_error(key_slope(heights, "height_cm year"))
  expect_error(key_slope(heights, height_cm + .))
  expect_error(key_slope(heights, height_cm))
})

test_that("add_key_slope does not handle character input", {
  expect_error(add_key_slope(heights, "height_cm ~ year"))
})

test_that("add_key_slope does not fail", {
  expect_s3_class(add_key_slope(heights, height_cm ~ year), "tbl_df")
})


test_that("add_key_slope fails when given non-formula", {
  expect_error(add_key_slope(heights, "height_cm year"))
  expect_error(add_key_slope(heights, height_cm + .))
  expect_error(add_key_slope(heights, height_cm))
})

Try the brolgar package in your browser

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

brolgar documentation built on June 22, 2024, 11:24 a.m.