is_true() expect_true(object, info = NULL, label = NULL)
NULL
, computed
from deparsed object.is_false
for complement Other expectations: equals
,
expect_equal
,
expect_equivalent
,
expect_error
, expect_false
,
expect_identical
, expect_is
,
expect_match
, expect_message
,
expect_output
,
expect_warning
,
gives_warning
, is_a
,
is_equivalent_to
, is_false
,
is_identical_to
, matches
,
prints_text
, shows_message
,
takes_less_than
, throws_error
expect_that(2 == 2, is_true())
expect_true(2 == 2)
# Failed expectations will throw an error
expect_that(2 != 2, is_true())
expect_that(!(2 != 2), is_true())
# or better:
expect_that(2 != 2, is_false())
a <- 1:3
expect_that(length(a) == 3, is_true())
# but better to use more specific expectation, if available
expect_that(length(a), equals(3))
Run the code above in your browser using DataLab