commit | d872cf8c8fca51b69a3d69241fce9a0e2f9192d9 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch@google.com> | Tue Oct 01 17:05:31 2024 -0700 |
committer | GitHub <noreply@github.com> | Tue Oct 01 17:05:31 2024 -0700 |
tree | b17131e58c008a8dbfa61d7f695f41ba94269537 | |
parent | c98c6e37a2336aace4ed7e0e4b3315faa8a14405 [diff] |
Special case maps with only value keys (#2257) Closes #2256 When checking deep equality on Map instances (including maps nested in other collection types) we allow keys which are instances of other collection (and don't have a useful `operator ==`) and keys which are `Condition` callbacks that could potentially match multiple keys of the actual value. This is maximally flexible, but it loses the nested path information we are otherwise able to keep for iterables compared by index. Check whether expectation maps have any keys which need this special treatment, and if not, special case to an algorithm close to the `Iterable` algorithm which can enqueue nested checks and maintain the direct known path into the collection. Update the doc comment to describe the new behavior. This does potentially introduce confusion since a change which adds a `Condition` key has to potential to make _other_ keys in the same expectation behaved differently. The benefit is a more actionable failure output for the much more common case of checking expectations with hardcoded keys.
Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api
and package:test_core
are implementation details and generally not user-facing.
package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher
and features a literate API.
Package | Description | Version |
---|---|---|
checks | A framework for checking values against expectations and building custom expectations. | |
test | A full featured library for writing and running Dart tests across platforms. | |
test_api | ||
test_core |