pointfreeco / swift-custom-dump

A collection of tools for debugging, diffing, and testing your application's data structures.
MIT License
800 stars 89 forks source link

Support ordered dictionaries/sets #80

Closed stephencelis closed 1 year ago

stephencelis commented 1 year ago

We currently auto-sort the children of any mirror with a display style of dictionary or set alphabetically. This is important for consistent dumps (good for snapshot tests, too), but affects types that don't need the sorting, like ordered dictionaries and sets.

This PR introduces an _UnorderedCollection protocol to control this behavior, and conforms Dictionary, Set, and their NS- predecessors, but leaves other types open to dumping and diffing in an ordered way by default.