Skip to content

Commit

Permalink
added tests for package/module and function aliases for separate call…
Browse files Browse the repository at this point in the history
…s linter
  • Loading branch information
radbasa committed Feb 21, 2024
1 parent f814e2e commit cdc3f40
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/test-linter_box_separate_calls_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,35 @@ test_that("box_separate_calls_linter blocks packages and modules in same box::us
dplyr[filter, select],
)"

bad_box_call_6 <- "box::use(
a = path/to/file,
dplyr,
)"

bad_box_call_7 <- "box::use(
path/to/file,
a = dplyr,
)"

bad_box_call_8 <- "box::use(
path/to/file,
dplyr[a = filter, select],
)"

bad_box_call_9 <- "box::use(
path/to/file[a = function1, function2],
dplyr,
)"

lint_message <- rex::rex("Separate packages and modules in their respective box::use() calls.")

lintr::expect_lint(bad_box_call_1, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_2, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_3, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_4, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_5, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_6, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_7, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_8, list(message = lint_message), linter)
lintr::expect_lint(bad_box_call_9, list(message = lint_message), linter)
})

0 comments on commit cdc3f40

Please sign in to comment.