Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Jan 12, 2024
1 parent 5f6f691 commit ec6b4c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Suggests:
shiny,
spelling,
styler (>= 1.2.0),
testthat (>= 3.2.0)
testthat (>= 3.2.1)
VignetteBuilder:
knitr
Config/Needs/website:
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/_snaps/reprex.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@
[5] "#> 3 1 1 1 1 3 0 expr FALSE"
[6] "```"

# reprex() errors for an R crash, by default

Code
code <- "utils::getFromNamespace(\"crash\", \"callr\")()\n"
reprex(input = code)
Condition
Error in `reprex_render()`:
! This reprex appears to crash R. Call `reprex()` again with `std_out_err = TRUE` to get more info.

8 changes: 4 additions & 4 deletions tests/testthat/test-reprex.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ test_that("reprex() works even if user uses fancy quotes", {
})

test_that("reprex() errors for an R crash, by default", {
# TODO: consider switching to expect_snapshot()
code <- 'utils::getFromNamespace("crash", "callr")()\n'
expect_error(reprex(input = code), "crash")
expect_snapshot(error = TRUE, {
code <- 'utils::getFromNamespace("crash", "callr")()\n'
reprex(input = code)
})
})

test_that("reprex() copes with an R crash, when `std_out_err = TRUE`", {
# TODO: consider switching to expect_snapshot()
code <- 'utils::getFromNamespace("crash", "callr")()\n'
expect_no_error(
out <- reprex(input = code, std_out_err = TRUE)
Expand Down

0 comments on commit ec6b4c8

Please sign in to comment.