mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 06:30:48 +01:00
(v3.0.1.9113) Fix infinite loop in the plain-text message fallback (used without cli or with old cli/rlang), e.g. for wisca(parallel = TRUE) without a future plan
This commit is contained in:
1 parent
01ca2b98ac
commit
f0699c6584
4 files changed
+40
-31
No files matched your search
@@ -98,3 +98,15 @@ test_that("test-misc.R", {
|
||||
expect_true(is_right, info = "the environmental data cannot be found for tidymodels/prep()")
|
||||
}
|
||||
})
|
||||
|
||||
test_that("test-cli_to_plain", {
|
||||
# plain-text fallback for when cli or rlang is unavailable: must always terminate, also when
|
||||
# word wrapping breaks a line within markup, or for expressions that cannot be evaluated
|
||||
expect_identical(AMR:::cli_to_plain("a {.code\nx()} b"), "a `x()` b")
|
||||
expect_identical(AMR:::cli_to_plain("{.arg x} {not_an_object_in_AMR} {1 + 1}"), "`x` {not_an_object_in_AMR} 2")
|
||||
msg <- "Setting {.code parallel = TRUE} requires a non-sequential {.help [{.fun future::plan}](future::plan)} to be active."
|
||||
expect_identical(
|
||||
gsub("[[:space:]]+", " ", AMR:::cli_to_plain(AMR:::word_wrap(msg, width = 40))),
|
||||
"Setting `parallel = TRUE` requires a non-sequential `future::plan()` to be active."
|
||||
)
|
||||
})
|
||||
Reference in new issue
Block a user