tests/testthat/test-not_in.R

test_that("not_in: target item is present in vector", {
  expect_false(1 %>% not_in(c(1, 2, 3, 4, "c", 6, 7, 8, "another thing", 1)))
})

test_that("not_in: target item not present in vector", {
  expect_true(not_in("c", c("cows", "cat", "3", 4, 5, 6)))
})

test_that("not_in: target is not present in NULL", {
  expect_true(not_in("c", NULL))
})

test_that("not_in: item not present in NA", {
  expect_true(not_in("c", NA))
})

test_that("not_in: NA is not present in vector", {
  expect_true(not_in(NA, c(1, 2, 3, 4, "c", 6, 7, 8, "another thing", 1)))
})

test_that("not_in: NA is present in vector", {
  expect_false(not_in(NA, c(1, 2, 3, 4, "c", NA, 7, 8, "another thing", 1)))
})
bcbeidel/notin documentation built on Nov. 3, 2019, 2:08 p.m.