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

use splat operator for apply call #101

Open
fchorney opened this issue Oct 11, 2022 · 0 comments
Open

use splat operator for apply call #101

fchorney opened this issue Oct 11, 2022 · 0 comments

Comments

@fchorney
Copy link
Contributor

fchorney commented Oct 11, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant