tests/testthat/test-ci.R

test_that("xtr_ci() works with all CI types.", {
  expect_no_error(xtr_ci(1:100))
  expect_no_error(xtr_ci(1:100, type = "HDI"))
  expect_no_error(xtr_ci(1:100, type = "ETI"))
  expect_error(
    xtr_ci(1:100, type = ""),
    "`type` must match 'ETI' or 'HDI', not ''."
  )
  expect_error(
    xtr_ci(1:100, type = NA_character_),
    "`type` must be a string \\(non-missing character scalar\\)."
  )
  expect_error(
    xtr_ci(1:100, type = 1),
    "`type` must be a string \\(non-missing character scalar\\)."
  )
})

Try the extras package in your browser

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

extras documentation built on July 16, 2026, 1:07 a.m.