Skip to content

Commit 570027e

Browse files
increase test coverage
1 parent b302ec1 commit 570027e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

R/set-assert-args.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ assert_transformers <- function(transformers) {
2929
)
3030
message <- paste(
3131
"Style guides without a name and a version field are depreciated and",
32-
action, " in styler >= 1.4. \nIf you are a user: Open an issue on",
32+
action, "in styler >= 1.4. \nIf you are a user: Open an issue on",
3333
"https://github.com/r-lib/styler and provide a reproducible example",
3434
"of this error. \nIf you are a developer:",
3535
"When you create a style guide with `styler::create_style_guide()`, the",

tests/testthat/test-exception_handling.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,16 @@ test_that("style_file with no tokens returns empty string and warning", {
2222
"not contain any tokens."
2323
))
2424
})
25+
26+
test_that("warning is given when transformers does not contain a version", {
27+
sg <- create_style_guide(style_guide_version = NULL)
28+
if (packageVersion("styler") < "1.4") {
29+
expect_fun <- expect_warning
30+
} else {
31+
expect_fun <- expect_error
32+
}
33+
expect_fun(
34+
assert_transformers(sg),
35+
"name and a version field are depreciated and won't be supported in styler >= 1.4"
36+
)
37+
})

0 commit comments

Comments
 (0)