tests/testthat/test-chk-tz.R

test_that("chk_tz", {
  expect_identical(chk_tz("UTC"), "UTC")
  expect_invisible(chk_tz("UTC"))
  expect_chk_error(
    chk_tz("TCU"),
    "^`\"TCU\"` must be a tz [(]non-missing scalar character of a recognized timezone[)][.]$"
  )
})

test_that("vld_tz", {
  expect_true(vld_tz("UTC"))
  expect_false(vld_tz("TCU"))
  expect_false(vld_tz(1))
  expect_false(vld_tz(character(0)))
  expect_false(vld_tz(c("UTC", "UTC")))
  expect_false(vld_tz(NA_character_))
})

Try the chk package in your browser

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

chk documentation built on Oct. 6, 2023, 9:06 a.m.