Skip to content

Commit 87e6a9f

Browse files
committed
Fix failing test
1 parent 7698c6c commit 87e6a9f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/testthat/test-expect-condition.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,17 @@ test_that("can capture Throwable conditions from rJava", {
7878

7979
test_that("capture correct trace_env (#1994)", {
8080
# This should fail, not error
81-
expect_failure(expect_error(stop("oops")) |> expect_warning())
82-
expect_failure(expect_warning(expect_error(stop("oops"))))
81+
status <- capture_success_failure({
82+
stop("oops") |> expect_error() |> expect_warning()
83+
})
84+
expect_equal(status$n_success, 1) # from expect_error()
85+
expect_equal(status$n_failure, 1) # from expect_warning()
86+
87+
status <- capture_success_failure({
88+
stop("oops") %>% expect_error() %>% expect_warning()
89+
})
90+
expect_equal(status$n_success, 1) # from expect_error()
91+
expect_equal(status$n_failure, 1) # from expect_warning()
8392
})
8493

8594
# expect_warning() ----------------------------------------------------------

0 commit comments

Comments
 (0)