tests/testthat/test-utils.R

test_that("null pipe will shortcut evaluation", {
  expect_equal("a" %||% stop("error"), "a")
  expect_error(NULL %||% stop("this is an error"), "this is an error")
})
carpentries/pegboard documentation built on Nov. 13, 2024, 8:53 a.m.