tests/testthat/test-console-width.R

test_that("errors", {
  withr::local_options(cli.width = letters)
  expect_snapshot_error(
    console_width()
  )

  withr::local_options(cli.width = NA_integer_)
  expect_snapshot_error(
    console_width()
  )

  withr::local_options(cli.width = -100L)
  expect_snapshot_error(
    console_width()
  )
})

Try the cli package in your browser

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

cli documentation built on March 31, 2023, 9:04 p.m.