tests/testthat/test-utils.R

test_that("if_any()", {
  expect_equal(if_any(TRUE, "x", "y"), "x")
  expect_equal(if_any(FALSE, "x", "y"), "y")
})

test_that("choose_version()", {
  expect_equal(choose_version("a", NULL), character(0))
  expect_equal(choose_version(NULL, letters), max(letters))
  expect_equal(choose_version(1L, c(10L, 20L, 30L)), 10L)
  expect_equal(choose_version("b", letters), "b")
})

Try the rfacts package in your browser

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

rfacts documentation built on Aug. 19, 2022, 5:18 p.m.