tests/testthat/test-check-flag.R

context("check-flag")

test_that("check_flag errors", {
  y <- TRUE
  expect_identical(check_flag(y), y)
  y <- 2
  expect_error(check_flag(y), "y must be of class 'logical'")
  y <- c(TRUE, TRUE)
  expect_error(check_flag(y), "y must be a scalar")
  y <- NA
  expect_error(check_flag(y), "y cannot include missing values")
  expect_identical(check_flag(FALSE), FALSE)
})

Try the datacheckr package in your browser

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

datacheckr documentation built on May 30, 2017, 6:05 a.m.