Skip to content

Commit 4690815

Browse files
proper version comparision with string
1 parent c43c99d commit 4690815

File tree

7 files changed

+12
-5
lines changed

7 files changed

+12
-5
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* added guarantee that styled code is parsable (#892).
4747
* An error is now thrown on styling if input unicode characters can't be
4848
correctly parsed for Windows and R < 4.2 (#883).
49+
* styling of text does not error anymore when the R option `OutDec` is set to
50+
a non-default value (#912).
4951
* Fix argument name `filetype` in Example for `style_dir()` (#855).
5052

5153

R/style-guides.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ tidyverse_style <- function(scope = "tokens",
222222
)
223223
)
224224

225-
if (getRversion() < 3.6) {
225+
if (getRversion() < "3.6") {
226226
transformers_drop$token$force_assignment_op <- NULL
227227
}
228228

tests/testthat/test-indention_operators.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_that("pipe is indended correctly", {
88
})
99

1010
test_that("base pipe is indended correctly", {
11-
skip_if(getRversion() < 4.1)
11+
skip_if(getRversion() < "4.1")
1212
expect_warning(test_collection("indention_operators",
1313
"base_pipe",
1414
transformer = style_text

tests/testthat/test-line_breaks_and_other.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test_that("line break before comma is removed and placed after comma ", {
4545
})
4646

4747
test_that("Can handle base R pie", {
48-
skip_if(getRversion() < 4.1)
48+
skip_if(getRversion() < "4.1")
4949
expect_warning(test_collection("line_breaks_and_other", "base-pipe-line",
5050
transformer = style_text
5151
), NA)

tests/testthat/test-parsing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test_that("mixed CRLF / LF EOLs fail", {
6565
})
6666

6767
test_that("unicode can't be propprely handled on Windows for R < 4.2", {
68-
msg <- ifelse(getRversion() < 4.2 && is_windows(),
68+
msg <- ifelse(getRversion() < "4.2" && is_windows(),
6969
"Can't parse input due to unicode restriction in base R\\.",
7070
NA
7171
)

tests/testthat/test-public_api.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,11 @@ test_that("Can display warning on unset styler cache", {
486486
)
487487
})
488488

489+
test_that("No sensitive to decimal option", {
490+
withr::local_options(OutDec = ",")
491+
expect_error(style_text("1"), NA)
492+
})
493+
489494
test_that("Can display warning on unset styler cache", {
490495
withr::local_options(styler.cache_root = "styler-perm")
491496
withr::local_seed(7)

tests/testthat/test-transformers-drop.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ test_that("tidyverse transformers are correctly dropped", {
9696

9797
names_tokens <- c(
9898
"fix_quotes",
99-
if (getRversion() < 3.6) "force_assignment_op"
99+
if (getRversion() < "3.6") "force_assignment_op"
100100
)
101101
expect_setequal(names(t_fun$token), names_tokens)
102102
})

0 commit comments

Comments
 (0)