View source: R/expect_true_false_linter.R
| expect_true_false_linter | R Documentation |
expect_true(x) over expect_equal(x, TRUE)testthat::expect_true() and testthat::expect_false() exist specifically
for testing the TRUE/FALSE value of an object.
testthat::expect_equal() and testthat::expect_identical() can also be
used for such tests, but it is better to use the tailored function instead.
expect_true_false_linter()
best_practices, package_development, pkg_testthat, readability
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "expect_equal(x, TRUE)",
linters = expect_true_false_linter()
)
lint(
text = "expect_equal(x, FALSE)",
linters = expect_true_false_linter()
)
# okay
lint(
text = "expect_true(x)",
linters = expect_true_false_linter()
)
lint(
text = "expect_false(x)",
linters = expect_true_false_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.