Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add testing helpers #88

Open
aplavin opened this issue Jul 16, 2024 · 0 comments
Open

add testing helpers #88

aplavin opened this issue Jul 16, 2024 · 0 comments

Comments

@aplavin
Copy link
Member

aplavin commented Jul 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant