tests/testthat/test-24_caller_cli.R

test_that("multiplication works", {
  caller_cli <- CreateCallerCliEnv()

  f <- function(x) {
    message("f:hello world")
    caller_cli$cli_alert_warning("g:hello world")
    g(x)
    return(1L)
  }

  g <- function(x) {
    message("g:hello world")
    caller_cli$cli_alert_info("g:hello world")
    return(x^2L)
  }

  caller_cli2 <- CreateCallerCliEnv(c("cli_abort", "cli_warn"))
  expect_error(caller_cli2$cli_abort("abort"))
  expect_warning(caller_cli2$cli_warn("warn"))
})

Try the SigBridgeRUtils package in your browser

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

SigBridgeRUtils documentation built on Sept. 29, 2026, 5:09 p.m.