tests/testthat/helper-spliced.R

is_splice_box <- function(x) {
  is_box(x, "rlang_box_splice")
}

expect_is_splice_box <- function(object) {
  # 1. Capture object and label
  act <- quasi_label(enquo(object), arg = "object")

  # 2. Call expect()
  expect(
    is_splice_box(act$val),
    sprintf("%s is not a splice box.", act$lab)
  )

  # 3. Invisibly return the value
  invisible(act$val)
}

expect_is_spliced <- function(object) {
  act <- quasi_label(enquo(object), arg = "object")

  expect(
    is_spliced(act$val),
    sprintf("%s is not spliced.", act$lab)
  )

  invisible(act$val)
}

Try the cascadess package in your browser

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

cascadess documentation built on Oct. 30, 2024, 9:29 a.m.