Rework _DeepMatcher so that it can display details of match failures. (#143)

Previously, if the user tried to do a deep match where the expectation
included a complex matcher (such as a "having" matcher), the failure
message would just say "failed to match ..."; it wouldn't call on the
expectation's matcher to explain why the match failed.

`_DeepMatcher` now stores a `_Mismatch` object in the matchState
map (under the key `mismatch`) recording in detail the location
of the mismatch, the actual and expected values, and if
necessary, a callback that describes the problem in more detail.
This replaces the old `reason` object, which was a String.  Using
a `_Mismatch` object allows us to pass the `verbose` flag through
when calling on the inner expectation's matcher to explain why
the match failed.  It also avoids unnecessary string operations
if no description is needed.
6 files changed
tree: 771f07af07caed2cb9f574f303f27cf999704576
  1. lib/
  2. test/
  3. .gitignore
  4. .test_config
  5. .travis.yml
  6. analysis_options.yaml
  7. CHANGELOG.md
  8. LICENSE
  9. pubspec.yaml
  10. README.md
README.md

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.