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

How to expect error with given class and capture message? #1691

Closed
hadley opened this issue Sep 23, 2022 · 1 comment
Closed

How to expect error with given class and capture message? #1691

hadley opened this issue Sep 23, 2022 · 1 comment
Labels
conditions feature a feature request or enhancement snapshot 📷

Comments

@hadley
Copy link
Member

hadley commented Sep 23, 2022

If you want to carefully check that an function yields an error with the expected class and capture the human readable message, you need something like this:

expect_snapshot({
  (expect_error(foo(), class = "bar"))
})

Could we turn this into a more concise assertion either by including the code in the output of expect_snapshot_error(), or if that's too disruptive to existing code, by adding a new expect_error_snapshot()?

Related to #1471

@hadley hadley changed the title How to expect error with given class _and_ capture message? How to expect error with given class and capture message? Sep 23, 2022
@hadley hadley added feature a feature request or enhancement conditions snapshot 📷 labels Mar 23, 2023
@hadley
Copy link
Member Author

hadley commented Apr 7, 2023

Need doesn't great anymore, so I'm going to close.

@hadley hadley closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conditions feature a feature request or enhancement snapshot 📷
Projects
None yet
Development

No branches or pull requests

1 participant