-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Some helpers to test constructof laws would be nice, similar to what we have in Accessors (https://github.com/JuliaObjects/Accessors.jl/blob/master/ext/AccessorsTestExt.jl).
Basically,
function test_constructorof_laws(obj, args; cmp=(==))
ctor = constructorof(typeof(obj))
reconstructed = ctor(getfields(obj)...)
@test cmp(obj, reconstructed)
@test typeof(obj) == typeof(reconstructed)
@test getfields(ctor(args...)) == args
end
Best to put into a Test extension, so this should wait until #86 -related issues get resolved.
jw3126, rafaqz and longemen3000
Metadata
Metadata
Assignees
Labels
No labels