Clone this repo:
  1. 6a9b83b Make FunctionMatcher private again (#196) by Nate Bosch · 10 days ago master
  2. 7e204b8 Annotate TypeMatcher.having with useResult (#195) by Nate Bosch · 10 days ago
  3. 0611d61 Stop depending on the deprecated `CastError` type. (#193) by Lasse R.H. Nielsen · 2 weeks ago
  4. faaaa04 Bump min SDK to 2.18.0 (#194) by Nate Bosch · 2 weeks ago
  5. eacb003 Fix CI crash due to `any` constraint on test_api (#191) by Kevin Moore · 4 weeks ago

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>