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

Add matchers for testing the stacktrace when an object is thrown #221

Open
rrousselGit opened this issue Aug 12, 2022 · 0 comments
Open

Comments

@rrousselGit
Copy link

Hello!

When dealing with error handling, it's quite important to make sure that the proper stacktrace is passed around. But at the moment, we don't really have a matcher to test the stacktrace when an error is thrown.

I think it would be helpful if we had a way to simultaneously both check the error thrown and the stacktrace. For this, I think an optional parameter on throwsA would be helpful.

We would be able to write:

Matcher throwA(Object errorMatcher, [Object? stackTraceMatcher]); 

await expectLater(
  Future<int>.error(StateError(''), StackTrace.empty),
  throwsA(isStateError, equals(StackTrace.empty)),
);
@natebosch natebosch transferred this issue from dart-lang/test May 10, 2023
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

No branches or pull requests

1 participant