Skip to content

Commit

Permalink
assign result to value for cleaner snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv committed Dec 18, 2024
1 parent 86325bb commit 24e30b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 2 additions & 13 deletions tests/testthat/_snaps/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@
Warning in `f()`:
Hi!

# all three starts of stop_on_error work as expected
# all three values of stop_on_error work as expected

Code
evaluate("stop(\"1\")\n2", stop_on_error = 2L)
ev <- evaluate("stop(\"1\")\n2", stop_on_error = 2L)
Condition
Error:
! 1
Output
<evaluation>
Source code:
stop("1")
Condition:
Error:
1
Source code:
2
Text output:
[1] 2

4 changes: 2 additions & 2 deletions tests/testthat/test-conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ test_that("an error terminates evaluation of multi-expression input", {
expect_output_types(ev, c("source", "error"))
})

test_that("all three starts of stop_on_error work as expected", {
test_that("all three values of stop_on_error work as expected", {
ev <- evaluate('stop("1")\n2', stop_on_error = 0L)
expect_output_types(ev, c("source", "error", "source", "text"))

ev <- evaluate('stop("1")\n2', stop_on_error = 1L)
expect_output_types(ev, c("source", "error"))

expect_snapshot(evaluate('stop("1")\n2', stop_on_error = 2L), error = TRUE)
expect_snapshot(ev <- evaluate("stop(\"1\")\n2", stop_on_error = 2L), error = TRUE)
})

test_that("errors during printing are captured", {
Expand Down

0 comments on commit 24e30b6

Please sign in to comment.