tests/testthat/test-as_date.R

today <- Sys.Date()

test_that("as_date works", {
  expect_equal(today, today |> as.character() |> as_date())
})

test_that("as_date returns NA in case of error", {
  expect_equal("today, today |> as.character()" |> as_date(), NA_character_)
})

test_that("as_date returns NA in case of error", {
  expect_equal("2022-13-01" |> as_date(), NA_character_)
})

Try the standardlastprofile package in your browser

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

standardlastprofile documentation built on May 29, 2024, 2:54 a.m.