File: test-alerts.R

package info (click to toggle)
r-cran-cli 3.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,288 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 764 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

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

test_that("generic", {
  expect_snapshot(local({
    cli_div(theme = list(".alert" = list(before = "GENERIC! ")))
    cli_alert("wow")
  }))
})

test_that_cli("success", {
  expect_snapshot(local({
    cli_alert_success("wow")
  }))
})

test_that_cli("danger", {
  expect_snapshot(local({
    cli_alert_danger("wow")
  }))
})

test_that_cli("warning", {
  expect_snapshot(local({
    cli_alert_warning("wow")
  }))
})

test_that_cli("info", {
  expect_snapshot(local({
    cli_alert_info("wow")
  }))
})

test_that("before and after can have spaces", {
  expect_snapshot(local({
    cli_div(theme = list(.alert = list(before = "x  ", after = "  x")))
    cli_alert("continuing that first alert", wrap = TRUE)
  }))
})