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