Open
Description
I have a test that looks like:
try {
functionExpectedToFail();
fail('Failed to fail.');
} on ExpectedException catch (e) {
// Significant code that extracts properties of `e` and that verifies the results...
}
While it's probably possible to rewrite the test to use a more typical check(functionExpectedToFail).throws<ExpectedException>()
style, there's a significant amount of code in my catch
block, so I think it's more readable with the explicit try
-catch
.
However, fail
(and the TestFailure
exception it wants to throw) are not exposed by package:test/scaffolding.dart
. Should they be? Is there something else I should use instead?
(And yes, I also could just explicitly throw some other exception.)