Skip to content

add testing helpers #88

@aplavin

Description

@aplavin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions