tests/testthat/test-check.R

test_that("check_tz", {
  rlang::with_options(lifecycle_verbosity = "error", {
    expect_error(check_tz(as.POSIXct("1970-01-01", tz = "GMT")))
  })
  rlang::local_options(lifecycle_verbosity = "quiet")
  x <- check_tz(as.POSIXct("1970-01-01", tz = "GMT"))
  expect_error(
    check_tz(x, "UTC"),
    "x's time zone must be 'UTC' not [(]'GMT'[)]"
  )
})

Try the dttr2 package in your browser

Any scripts or data that you put into this service are public.

dttr2 documentation built on Nov. 14, 2023, 5:10 p.m.