Skip to content

Commit 6389d55

Browse files
bad copy-paste
1 parent f4b9481 commit 6389d55

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/testthat/test-unnecessary_lambda_linter.R

+5-2
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,16 @@ test_that("cases with braces are caught", {
250250

251251
test_that("function shorthand is handled", {
252252
skip_if_not_r_version("4.1.0")
253-
253+
linter <- unnecessary_lambda_linter()
254+
linter_allow <- unnecessary_lambda_linter(allow_comparison = TRUE)
255+
254256
expect_lint(
255257
"lapply(DF, \\(x) sum(x))",
256258
rex::rex("Pass sum directly as a symbol to lapply()"),
257-
unnecessary_lambda_linter()
259+
linter
258260
)
259261

262+
lint_msg <- rex::rex("Compare to a constant after calling sapply() to get", anything, "sapply(x, foo)")
260263
expect_lint("sapply(x, \\(xi) foo(xi) == 2)", lint_msg, linter)
261264
expect_lint("sapply(x, \\(xi) foo(xi) == 'a')", lint_msg, linter)
262265
expect_lint("sapply(x, \\(xi) foo(xi) == 1 + 2i)", lint_msg, linter)

0 commit comments

Comments
 (0)