Stop depending on the deprecated `CastError` type. (#193)

Use `TypeError` to implement `isCastError`
4 files changed
tree: 5409ce6cdbe04b68830dd5649333ce7f758135c1
  1. .github/
  2. lib/
  3. test/
  4. .gitignore
  5. analysis_options.yaml
  6. CHANGELOG.md
  7. LICENSE
  8. pubspec.yaml
  9. README.md
README.md

Dart CI pub package package publisher

Support for specifying test expectations, such as for unit tests.

The matcher library provides a third-generation assertion mechanism, drawing inspiration from Hamcrest.

For more information, see Unit Testing with Dart.

Best Practices

Prefer semantically meaningful matchers to comparing derived values

Matchers which have knowledge of the semantics that are tested are able to emit more meaningful messages which don't require reading test source to understand why the test failed. For instance compare the failures between expect(someList.length, 1), and expect(someList, hasLength(1)):

// expect(someList.length, 1);
  Expected: <1>
    Actual: <2>
// expect(someList, hasLength(1));
  Expected: an object with length of <1>
    Actual: ['expected value', 'unexpected value']
     Which: has length of <2>