Skip to content

Commit 1460d81

Browse files
alignment ignore option must be part of more specs
1 parent 06a3696 commit 1460d81

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

R/utils-cache.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,11 @@ get_cache_dir <- function(cache_name = cache_get_name()) {
204204
#' Syntactic sugar for creating more specs. This is useful when we want to add
205205
#' more arguments (because we can search for this function in the source code).
206206
#' @keywords internal
207-
cache_more_specs <- function(include_roxygen_examples, base_indention) {
207+
cache_more_specs <- function(include_roxygen_examples,
208+
base_indention) {
208209
list(
209210
include_roxygen_examples = include_roxygen_examples,
210-
base_indention = base_indention
211+
base_indention = base_indention,
212+
ignore_alignment = getOption("styler.ignore_alignment", FALSE)
211213
)
212214
}

man/combine_children.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/rds_to_version.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-cache-interaction-more-specs.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ test_that("base_indention is respected in caching", {
1010
)
1111
})
1212

13+
test_that("ignore_alignment is respected in caching", {
14+
local_test_setup(cache = TRUE)
15+
text <- c("call(", " arxone = 1,", " tw3 = 2", ")")
16+
text_without_alignment <- c("call(", " arxone = 1,", " tw3 = 2", ")")
17+
with_detection <- style_text(text)
18+
withr::local_options(styler.ignore_alignment = TRUE)
19+
without_detection <- style_text(text)
20+
expect_equal(
21+
as.character(without_detection),
22+
as.character(text_without_alignment)
23+
)
24+
cache_info(format = "tabular")$size == 2
25+
})
26+
1327
test_that("cache is deactivated at end of caching related testthat file", {
1428
expect_false(cache_is_activated())
1529
})

0 commit comments

Comments
 (0)