tests/testthat/test-ZZZ.R

library(testthat)
library(mockery)

test_that("null replacement works", {
  expect_equal(1 %||% 2, 1)
  expect_equal(NULL %||% 2, 2)
  expect_equal(NULL %||% 1 %||% 2, 1)
  expect_equal(NULL %||% NULL %||% 2, 2)
})

test_that("is_date works", {
  expect_true(is_date(as.Date("2020-01-01")))
  expect_true(is_date(Sys.time()))
  expect_true(is_date(as.POSIXlt(Sys.time())))
  expect_false(is_date("a"))
  expect_false(is_date(1))
})

Try the NHSRplotthedots package in your browser

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

NHSRplotthedots documentation built on Nov. 4, 2021, 1:07 a.m.