tests/testthat/test_is_true_or_false.R

library(rutilities)

context("Test that is_true_or_false throws error correctly")

test_that("Test that non-TRUE or FALSE arguments throw error",{
    expect_error(is_true_or_false(rep(TRUE, 2)),
                 "Argument must be TRUE or FALSE")
    expect_error(is_true_or_false(NA),
                 "Argument must be TRUE or FALSE")
    expect_error(is_true_or_false("TRUE"),
                 "Argument must be TRUE or FALSE")
    expect_error(is_true_or_false(1),
                 "Argument must be TRUE or FALSE")
})
andrewjpfeiffer/rutilities documentation built on May 11, 2019, 6:26 p.m.