Skip to content

Latest commit

 

History

42 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjectDiff

Stable Dev Build Status Aqua

Explain through visuals why two objects do not satisfy ==.

It can be frustrating for highly nested objects to just find out that x == y returns false.

ObjectDiff.jl is an attempt to make the comparison more detailed by going recursively through fields, elements or pairs (depending on the object) and compare different aspects (type, size, content, etc...). The main function to use is compare(x, y).

The final object is printed as a tree and instead of showing the first discrepancy that produced false, it shows all inconsistencies at once.

Example

julia> struct Foo
 a
 b
end;

julia> x = Foo(Foo(2, 4), 5);
julia> y = Foo("C", nothing);
julia> compare(x, y)
Foo(Foo(2, 4), 5)  Foo("C", nothing)
└─ fields: a, b
   ├─ a: type: Foo  String
   └─ b: 5  nothing

Test macro

To directly integrate it in your tests, you can use

@test_diff x == y

which will print the difference tree if they fail to satisfy equality.

About

Explicitly display why two objects do not satisfy `==`

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages