Skip to content

Commit

Permalink
Fix format_error() edge case
Browse files Browse the repository at this point in the history
Closes #394.
  • Loading branch information
gaborcsardi committed Feb 9, 2022
1 parent 51c4812 commit 979e2f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/format-conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ format_error <- function(message, .envir = parent.frame()) {
})(), collapse = TRUE, strip_newline = TRUE)

# remove "Error: " that was only needed for the wrapping
formatted1[1] <- sub("Error: ", "", formatted1[1])
formatted1[1] <- sub("Error:[ ]?", "", formatted1[1])

update_rstudio_color(formatted1)
}
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-format-conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,7 @@ test_that_cli("suppressing Unicode bullets", {
)))
}))
})

test_that("edge cases", {
expect_equal(cli::format_error(""), "")
})

0 comments on commit 979e2f4

Please sign in to comment.