tests/testthat/test-not_null.R

test_that("not_null returns FALSE if value is NULL", {
  not_null(NULL) %>% expect_false()
})

test_that("not_null returns TRUE if value is not NULL", {
  for_all(
    a = anything(),
    property = function(a) (is.null(a) || not_null(a)) %>% expect_true()
  )
})

Try the maybe package in your browser

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

maybe documentation built on Aug. 7, 2023, 5:11 p.m.