Skip to content

use splat operator for apply call #101

Open
@fchorney

Description

@fchorney

Looking at this, https://github.com/invenia/Mocking.jl/blob/master/src/patch.jl#L138-L140

Would anybody be opposed to adding something like

function apply(body::Function, patches...; debug::Bool=false)
    return apply(body, collect(patches);  debug)
end

This is mostly just a visual enhancement, and has some small usability improvements.

Let's say I have a patch that I generally use for multiple tests, but sometimes I want to add a secondary patch you end up with

apply(patch_1) do ... end

apply([patch_1, patch_2]) do ... end

IMO it would look nicer if we could just add n number of patches without having to enclose them in an array

apply(patch_1) do ... end

apply(patch_1, patch_2) do ... end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions