You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some foo(x), mocking does not support the broadcasted expression:
julia>foo(x) =# do stuff
julia>functionbar(X)
return@mockfoo.(X)
end
ERROR: LoadError: expression is not a function call
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] @mock(::LineNumberNode, ::Module, ::Any) at /Users/glenn/.julia/packages/Mocking/U41JO/src/mock.jl:6
in expression starting at REPL[8]:2
So one needs to call broadcast explicitly in the function call and in the patch:
function bar(X)
return @mock broadcast(foo, X)
end
# currently works
patch = @patch broadcast(foo, X) = # do stuff
Whereas it would be nice if the patch for unbroadcasted foo could also implicitly handle the broadcasted case so one then doesn't have to create two different patches:
function bar(X)
return @mock foo.(X)
end
# should work for @mock foo(x) and @mock foo.(X)
patch = @patch f(x) = # do stuff
The text was updated successfully, but these errors were encountered:
For some
foo(x)
, mocking does not support the broadcasted expression:So one needs to call
broadcast
explicitly in the function call and in the patch:Whereas it would be nice if the patch for unbroadcasted
foo
could also implicitly handle the broadcasted case so one then doesn't have to create two different patches:The text was updated successfully, but these errors were encountered: