tests/testthat/test-test.R

# test-test.R

# test_inherits ----
test_that("test_inherits returns TRUE for correct class", {
  expect_true(test_inherits("papaya", "character"))
  expect_true(test_inherits(1L, "integer"))
  expect_true(test_inherits(iris, "data.frame"))
})

test_that("test_inherits returns FALSE for incorrect class", {
  expect_message(result <- test_inherits(1.5, "integer"), "is not")
  expect_false(result)
  expect_message(result <- test_inherits(iris, "list"), "is not")
  expect_false(result)
})

Try the rtemis.core package in your browser

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

rtemis.core documentation built on April 22, 2026, 1:11 a.m.