tests/testthat/test-stabilize_chr_scalar.R

test_that("stabilize_chr_scalar() allows length-1 chrs through", {
  expect_identical(stabilize_chr_scalar("a"), "a")
})

test_that("stabilize_chr_scalar() provides informative error messages", {
  given <- letters
  expect_snapshot(
    stabilize_chr_scalar(given),
    error = TRUE
  )

  wrapper <- function(wrapper_val, ...) {
    return(stabilize_chr_scalar(wrapper_val, ...))
  }
  expect_snapshot(
    wrapper(given),
    error = TRUE
  )
})

Try the stbl package in your browser

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

stbl documentation built on May 29, 2024, 5:52 a.m.