Skip to content

Commit

Permalink
metadata tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Dec 25, 2023
1 parent 194e702 commit 3eb14ab
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions tests/testthat/test-if_switch_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ test_that("max_branch_lines= and max_branch_expr= arguments work", {
expect_lint(five_lines_three_expr_lines, NULL, max_lines2_linter)
expect_lint(five_lines_three_expr_lines, NULL, max_lines4_linter)
expect_lint(five_lines_three_expr_lines, NULL, max_expr2_linter)
expect_lint(five_lines_three_expr_lines, lint_msg, max_expr4_linter)
expect_lint(
five_lines_three_expr_lines,
list(lint_msg, line_number = 1L),
max_expr4_linter
)

five_expr_three_lines_lines <- trim_some("
if (x == 'a') {
Expand All @@ -204,7 +208,11 @@ test_that("max_branch_lines= and max_branch_expr= arguments work", {
}
")
expect_lint(five_expr_three_lines_lines, NULL, max_lines2_linter)
expect_lint(five_expr_three_lines_lines, lint_msg, max_lines4_linter)
expect_lint(
five_expr_three_lines_lines,
list(lint_msg, line_number = 1L),
max_lines4_linter
)
expect_lint(five_expr_three_lines_lines, NULL, max_expr2_linter)
expect_lint(five_expr_three_lines_lines, NULL, max_expr4_linter)
})
Expand Down Expand Up @@ -274,9 +282,17 @@ test_that("max_branch_lines= and max_branch_expr= block over-complex switch() to
}
)
")
expect_lint(three_per_branch_lines, lint_msg, max_lines2_linter)
expect_lint(
three_per_branch_lines,
list(lint_msg, line_number = 1L),
max_lines2_linter
)
expect_lint(three_per_branch_lines, NULL, max_lines4_linter)
expect_lint(three_per_branch_lines, lint_msg, max_expr2_linter)
expect_lint(
three_per_branch_lines,
list(lint_msg, line_number = 1L),
max_expr2_linter
)
expect_lint(three_per_branch_lines, NULL, max_expr4_linter)

five_per_branch_lines <- trim_some("
Expand Down

0 comments on commit 3eb14ab

Please sign in to comment.