File: test-verbosity.R

package info (click to toggle)
r-cran-lifecycle 1.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 576 kB
  • sloc: sh: 15; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 569 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
test_that("verbosity option is validated", {
  opt <- with_options(lifecycle_verbosity = NULL, lifecycle_verbosity())
  expect_identical(opt, "default")

  expect_warning(
    with_options(lifecycle_verbosity = NA, lifecycle_verbosity()),
    "must be set to one of"
  )
})

test_that("verbosity option has precedence over user env (#113)", {
  mytool <- function() {
    deprecate_soft("1.0.0", "mytool()")
    10 * 10
  }

  rlang::local_options(lifecycle_verbosity = "error")

  expect_error(
    exec(mytool, .env = global_env()),
    class = "defunctError"
  )
})