Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
* added guarantee that styled code is parsable (#892).
* An error is now thrown on styling if input unicode characters can't be
correctly parsed for Windows and R < 4.2 (#883).
* styling of text does not error anymore when the R option `OutDec` is set to
a non-default value (#912).
* Fix argument name `filetype` in Example for `style_dir()` (#855).


Expand Down
2 changes: 1 addition & 1 deletion R/style-guides.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ tidyverse_style <- function(scope = "tokens",
)
)

if (getRversion() < 3.6) {
if (getRversion() < "3.6") {
transformers_drop$token$force_assignment_op <- NULL
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-indention_operators.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_that("pipe is indended correctly", {
})

test_that("base pipe is indended correctly", {
skip_if(getRversion() < 4.1)
skip_if(getRversion() < "4.1")
expect_warning(test_collection("indention_operators",
"base_pipe",
transformer = style_text
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-line_breaks_and_other.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("line break before comma is removed and placed after comma ", {
})

test_that("Can handle base R pie", {
skip_if(getRversion() < 4.1)
skip_if(getRversion() < "4.1")
expect_warning(test_collection("line_breaks_and_other", "base-pipe-line",
transformer = style_text
), NA)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-parsing.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test_that("mixed CRLF / LF EOLs fail", {
})

test_that("unicode can't be propprely handled on Windows for R < 4.2", {
msg <- ifelse(getRversion() < 4.2 && is_windows(),
msg <- ifelse(getRversion() < "4.2" && is_windows(),
"Can't parse input due to unicode restriction in base R\\.",
NA
)
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-public_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,11 @@ test_that("Can display warning on unset styler cache", {
)
})

test_that("No sensitive to decimal option", {
withr::local_options(OutDec = ",")
expect_error(style_text("1"), NA)
})

test_that("Can display warning on unset styler cache", {
withr::local_options(styler.cache_root = "styler-perm")
withr::local_seed(7)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-transformers-drop.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test_that("tidyverse transformers are correctly dropped", {

names_tokens <- c(
"fix_quotes",
if (getRversion() < 3.6) "force_assignment_op"
if (getRversion() < "3.6") "force_assignment_op"
)
expect_setequal(names(t_fun$token), names_tokens)
})
Expand Down