File: test-signal.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 (26 lines) | stat: -rw-r--r-- 805 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
test_that("signal stage captures desired data", {
  f <- function() {
    signal_stage("experimental", "pkg::foo(bar = 'baz')")
  }

  cnd <- expect_condition(f(), class = "lifecycle_stage")
  expect_equal(cnd$stage, "experimental")
  expect_equal(cnd$package, "pkg")
  expect_equal(cnd$function_nm, "foo")
  expect_equal(cnd$argument, "bar")
  expect_equal(cnd$reason, "baz")
})

test_that("signal generates user friendly message", {
  expect_snapshot({
    (expect_condition(signal_stage("experimental", "foo()")))
    (expect_condition(signal_stage("superseded", "foo(bar)")))
  })
})

test_that("signal_stage supports with", {
  expect_snapshot({
    (expect_condition(signal_stage("superseded", "foo()", "bar()")))
    (expect_condition(signal_stage("superseded", "foo(bar=)", "foo(baz=)")))
  })
})