tests/testthat/test-my_lm.R

data(mtcars)

test_that("my_lm works mathematically", {
  expect_is(my_lm(mpg ~ hp + wt, mtcars), "matrix")
})

test_that("non formula input throws error", {
  expect_error(my_lm(10, "data frame"))
})

test_that("non data frame input throws error", {
  expect_error(my_lm(mpg ~ hp + wt, 10))
})
arielle-min/project3package documentation built on March 22, 2021, 1:47 p.m.