tests/testthat/test-utils.R

context("util functions")

test_that("ct", {
  expect_is(ct, "function")
  expect_equal(length(ct(list(NULL, 4))), 1)
})

test_that("assert_is", {
  expect_is(assert_is, "function")
  expect_null(assert_is(TRUE, "logical"))
  expect_error(assert_is(TRUE, "character"), "TRUE must be of class character")
})

test_that("assert_n", {
  expect_is(assert_n, "function")
  expect_null(assert_n(letters, 26))
  expect_error(assert_n(letters, 4), "letters must be length 4")
})

Try the hoardr package in your browser

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

hoardr documentation built on Feb. 16, 2023, 7:28 p.m.