tests/testthat/test-utils.R

context("rbhl utils")

test_that("bool2let", {
  expect_null(bool2let(NULL))
  expect_equal(bool2let(TRUE, letters[1:2]), "a")
  expect_equal(bool2let(FALSE, letters[1:2]), "b")

  # errors
  expect_error(bool2let(TRUE), "missing")
  expect_error(bool2let("asdf"), "is not TRUE")
  expect_error(bool2let(TRUE, letters[1:3]), "is not TRUE")
})

Try the rbhl package in your browser

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

rbhl documentation built on May 13, 2021, 9:07 a.m.