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