An object diff framework in Pharo.
Assertions failing in SUnit are sometimes difficult to dig into. In particular, those comparing two long and almost identical strings.
Object Diff injects extension methods into certain classes to compute the differences with arbitrary instances. It uses double-dispatch to properly compare classes according to their semantics. As last resort, it relies on instVar comparisions.
First, load it with Metacello:
Metacello new repository: 'github://rydnr/object-diff:main'; baseline: 'ObjectDiff'; load
Afterwards, just call yourInstance odDiff: anotherInstance
. It will return a specific instance of the classes of the package Object-Diff. You'll be able to ask if they are identical
, incompatible
, or to display the differences in a custom format.
By default Object-Diff uses wildcards to compare objects. For example,
'abc' odDiff: '<ANYTHING>' identical
returns true
. You can disable this feature with ODWildcards disable
, or add your own wildcards with
ODWildcards matches at: '*' put: true
- Add Glamorous Toolkit visualization.
- Support for file diffs.
- Improve String vs String differences.
- Background of the Pharo image by JoBischPeuchet from Pixabay.