File: test-text.R

package info (click to toggle)
r-cran-cli 3.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 607 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

start_app()
on.exit(stop_app(), add = TRUE)

test_that("text is wrapped", {
  withr::local_options(cli.width = 60)
  withr::local_rng_version("3.3.0")
  set.seed(42)
  expect_snapshot(local({
    cli_div(class = "testcli", theme = test_style())
    cli_h1("Header")
    cli_text(lorem_ipsum())
  }))
})

test_that("verbatim text is not wrapped", {
  cli_div(class = "testcli", theme = test_style())
  withr::local_options(cli.width = 60)
  suppressMessages(cli_h1("Header"))
  txt <- strrep("1234567890 ", 20)
  out <- capt0(cli_verbatim(txt), strip_style = TRUE)
  expect_equal(out, paste0(txt, "\n"))
})