| is_true {testthat} | R Documentation |
These are fall-back expectations that you can use when none of the other more specific expectations apply. The disadvantage is that you may get a less informative error message.
is_true() expect_true(object, info = NULL, label = NULL) is_false() expect_false(object, info = NULL, label = NULL)
object |
object to test |
info |
extra information to be included in the message (useful when writing tests in loops). |
label |
object label. When |
Attributes are ignored.
is_false for complement
Other expectations: equals_reference,
expect_equal_to_reference;
equals, expect_equal;
expect-compare,
expect_less_than,
expect_more_than,
is_less_than, is_more_than;
expect_equivalent,
is_equivalent_to;
expect_error, throws_error;
expect_identical,
is_identical_to; expect_is,
is_a; expect_match,
matches; expect_message,
shows_message; expect_named,
has_names; expect_null,
is_null; expect_output,
prints_text; expect_warning,
gives_warning;
takes_less_than
expect_true(2 == 2) # Failed expectations will throw an error ## Not run: expect_true(2 != 2) ## End(Not run) expect_true(!(2 != 2)) # or better: expect_false(2 != 2) a <- 1:3 expect_true(length(a) == 3) # but better to use more specific expectation, if available expect_equal(length(a), 3)