tests/testthat/test-utils.R

test_that("%||% returns right if left is NULL", {
  expect_identical("a" %||% "b", "a")
  expect_identical(NULL %||% "b", "b")
})

test_that("drop_null", {
  expect_identical(drop_null(list(NULL, 1)), list(1))
})

test_that("drop_na", {
  expect_true(drop_na(c(TRUE, NA)))
})

test_that("last", {
  expect_true(last(list(FALSE, TRUE)))
  expect_true(last(c(FALSE, TRUE)))
})

Try the ftExtra package in your browser

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

ftExtra documentation built on Sept. 29, 2023, 9:06 a.m.