Skip to content

Commit

Permalink
further condense test code
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Oct 24, 2024
1 parent d7d83e6 commit b3e8657
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions tests/testthat/test-commented_code_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,12 @@ test_that("commented_code_linter can detect operators in comments and lint corre
)
})

test_that("commented_code_linter can detect commented code ending with a base pipe", {
skip_if_not_r_version("4.1.0")
test_that("commented_code_linter can detect commented code ending with pipes", {
linter <- commented_code_linter()
lint_msg <- rex::rex("Remove commented code.")

expect_lint(
"# f() |>",
rex::rex("Remove commented code."),
commented_code_linter()
)
})
expect_lint("# f() %>%", lint_msg, linter)

test_that("commented_code_linter can detect commented code ending with a {magrittr} pipe", {
expect_lint(
"# f() %>%",
rex::rex("Remove commented code."),
commented_code_linter()
)
skip_if_not_r_version("4.1.0")
expect_lint("# f() |>", lint_msg, linter)
})

0 comments on commit b3e8657

Please sign in to comment.