tests/testthat/test-function-matchingTimeFormat.R

#
# This test file has been generated by kwb.test::create_test_files()
#

test_that("matchingTimeFormat() works", {

  kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = 1)
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = 1:2)
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = "a")
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = c("a", "b"))
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = TRUE)
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = FALSE)
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = as.POSIXct("2018-06-03 23:50:00"))
   kwb.datetime:::matchingTimeFormat(timestamp = "a", timeFormats = list(key = c("a", "b"), value = 1:2))
   expect_error(
    kwb.datetime:::matchingTimeFormat(timestamp = 1, timeFormats = 1)
    # Exactly one character timestamp expected!
  )

})
KWB-R/kwb.datetime documentation built on July 9, 2021, 10:28 p.m.