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::scoped_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 Sept. 19, 2021, 9:06 a.m.