JuliaTesting / SimpleMock.jl

A basic mocking module
https://juliatesting.github.io/SimpleMock.jl
MIT License
21 stars 4 forks source link

Mocking specific methods #4

Closed christopher-dG closed 5 years ago

christopher-dG commented 5 years ago

Right now you can only mock all of a function's methods. It would be nice to be able to do something like this:

mock((+, Int, Int) => (a, b) -> 2a + 2b) do plus
    @assert 0x1 + 0x2 == 0x3  # Not mocked
    @assert 1 + 2 == 6  # Mocked
    @assert called_once_with(plus, 1, 2)
end