Skip to content

Commit

Permalink
Add a test for early return
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Jul 9, 2024
1 parent 7b2b8be commit 9034b84
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/testthat/test-evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ test_that("on.exit is evaluated at end of code", {
expect_snapshot(ev)
})

test_that("return causes an early return", {
ev <- evaluate::evaluate(c(
"1 + 1",
"return()",
"2 + 2"
))
expect_output_types(ev, c("source", "text", "source"))
})


test_that("check_stop_on_error converts integer to enum", {
expect_equal(check_stop_on_error(0), "continue")
expect_equal(check_stop_on_error(1), "stop")
Expand Down

0 comments on commit 9034b84

Please sign in to comment.