Force && conditions in expect_true(), expect_false() to be written separately
Source:R/conjunct_test_linter.R
conjunct_test_linter.Rd
For readability of test outputs, testing only one thing per call to
testthat::expect_true()
is preferable, i.e.,
expect_true(A); expect_true(B)
is better than expect_true(A && B)
, and
expect_false(A); expect_false(B)
is better than expect_false(A || B)
.
Arguments
- allow_named_stopifnot
Logical,
TRUE
by default. IfFALSE
, "named" calls tostopifnot()
, available since R 4.0.0 to provide helpful messages for test failures, are also linted.
Details
Similar reasoning applies to &&
usage inside stopifnot()
and assertthat::assert_that()
calls.
See also
linters for a complete list of linters available in lintr.