Skip to content

Commit 51593e4

Browse files
new tests
1 parent afec743 commit 51593e4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/testthat/test-unnecessary_lambda_linter.R

+8
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ test_that("function shorthand is handled", {
256256
rex::rex("Pass sum directly as a symbol to lapply()"),
257257
unnecessary_lambda_linter()
258258
)
259+
260+
expect_lint("sapply(x, \\(xi) foo(xi) == 2)", lint_msg, linter)
261+
expect_lint("sapply(x, \\(xi) foo(xi) == 'a')", lint_msg, linter)
262+
expect_lint("sapply(x, \\(xi) foo(xi) == 1 + 2i)", lint_msg, linter)
263+
264+
expect_no_lint("sapply(x, \\(xi) foo(xi) == 2)", linter_allow)
265+
expect_no_lint("sapply(x, \\(xi) foo(xi) == 'a')", linter_allow)
266+
expect_no_lint("sapply(x, \\(xi) foo(xi) == 1 + 2i)", linter_allow)
259267
})
260268

261269
test_that("lints vectorize", {

0 commit comments

Comments
 (0)