Skip to content

Should fail and TestFailure be exposed by scaffolding.dart? #2073

Open
@jamesderlin

Description

@jamesderlin

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:checksIssues related to pkg:checks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions