View source: R/expect_length_linter.R
| expect_length_linter | R Documentation |
expect_length(x, n) over expect_equal(length(x), n)testthat::expect_length() exists specifically for testing the length() of
an object. testthat::expect_equal() can also be used for such tests,
but it is better to use the tailored function instead.
expect_length_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(length(x), 2L)",
linters = expect_length_linter()
)
# okay
lint(
text = "expect_length(x, 2L)",
linters = expect_length_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.