tests/testthat/test-utilities.R

test_that(".NeverDrop() works", {
  expect_error(.NeverDrop(FALSE, letters))
  expect_equal(character(0), expect_warning(.NeverDrop('NOT THERE', letters)))
  expect_equal(character(0), .NeverDrop(labels = letters))
  expect_equal(character(0), .NeverDrop(NULL, labels = letters))
  expect_equal(character(0), .NeverDrop(logical(0), labels = letters))
  expect_equal(letters[2:3], sort(.NeverDrop(c('b', 'c'), labels = letters)))
  expect_equal(letters[2:3], sort(.NeverDrop(3:2, labels = letters)))
  expect_equal(letters[26], expect_warning(.NeverDrop(26:27, labels = letters)))
})

Try the Rogue package in your browser

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

Rogue documentation built on Jan. 13, 2022, 5:07 p.m.