Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshot_replay(<rlang_error>) #1473

Closed

Conversation

romainfrancois
Copy link
Contributor

library(rlang)
library(testthat)
#> 
#> Attaching package: 'testthat'
#> The following objects are masked from 'package:rlang':
#> 
#>     is_false, is_null, is_true

f <- function() abort("f()")
g <- function() tryCatch(f(), error = function(e) abort("g()", parent = e))

test_that("", {
  local_edition(3)
  
  expect_snapshot(error = TRUE, {
    g()
  })
  
})
#> Can't compare snapshot to reference when testing interactively
#> ℹ Run `devtools::test()` or `testthat::test_file()` to see changes
#> ℹ Current value:
#> Code
#>   g()
#> Error
#>   <error/rlang_error>
#>   Error: 
#>     g()
#>   Caused by error in `f()`: 
#>     f()
#> ── Skip (test-that.R:53:3):  ───────────────────────────────────────────────────
#> Reason: empty test

Created on 2021-10-07 by the reprex package (v2.0.1.9000)

@romainfrancois
Copy link
Contributor Author

closes #1471

@romainfrancois romainfrancois marked this pull request as draft October 7, 2021 12:44
@romainfrancois romainfrancois marked this pull request as ready for review October 7, 2021 12:51
@romainfrancois romainfrancois deleted the snapshot_replay_rlang_error branch November 8, 2021 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant