Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Jan 22, 2024
1 parent 55fb05c commit 045da3d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,19 @@ test_that("perl-only regular expressions are accepted in config", {
writeLines("a <- 1", "aaa.R")
expect_silent(lint("aaa.R"))
})

test_that("settings can be put in a sub-directory", {
withr::local_dir(withr::local_tempdir())

dir.create(".settings")
.lintr <- ".settings/.lintr.R"
writeLines("linters <- list(line_length_linter(10))", .lintr)

dir.create("R")
writeLines("abcdefghijklmnopqrstuvwxyz=1", "R/a.R")

writeLines(c("Package: foo", "Version: 0.1"), "DESCRIPTION")

withr::local_options(lintr.linter_file = .lintr)
expect_length(lint_package(), 1L)
})

0 comments on commit 045da3d

Please sign in to comment.