tests/testthat/test-my_lm.R

# within my_lm.r
test_that("my_lm works mathematically", {
  expect_type(my_lm(mpg ~ hp, data = mtcars), "double")
  expect_s3_class(my_lm(mpg ~ hp, data = mtcars), "table")
})
test_that("not a dataframe", {
  expect_error(my_lm("a string"))
  expect_error(my_lm(123))
})
chen1649/mypackage documentation built on Dec. 19, 2021, 3:03 p.m.