File: test-helper.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
skip_on_cran()
skip_if_not_installed("withr")
withr::with_options(
  list(easystats_errors = TRUE),
  test_that(".safe works with options", {
    expect_error(parameters:::.safe(mean(fd)), regex = "object 'fd' not found")
    expect_identical(parameters:::.safe(mean(fd), 1L), 1L)
    expect_identical(parameters:::.safe(mean(c(1, 2, 3))), 2)
  })
)
test_that(".safe works", {
  expect_null(parameters:::.safe(mean(fd)))
  expect_identical(parameters:::.safe(mean(c(1, 2, 3))), 2)
})