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
When trying to spy on a protocol I usually only require the protocol and not :all from the namespace to avoid pollution of the tests namespace. However, with the current implementation of the spy macro I cannot do this. To clarify, this is how the problem is reproducible:
user> (nstest1)
nil
test1> (defprotocolTestProto (a [this arg]))
TestProto
test1> (nstest2)
nil
test2> (require '[shrubbery.core :as s])
nil
test2> (require 'test1)
nil
test2> (deffake-impl (reify test1/TestProto (a [_ _] :fake)))
#'test2/fake-impl
test2> (s/spy test1/TestProto fake-impl)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(/tmp/form-init8310557090395405498.clj:1:1)
If I require everything from the test1 namespace it works:
Is there a way to make it work? I.e. by taking the namespace into account or prefixing the methods with a dot when generating the proxy calls in the macro?
The text was updated successfully, but these errors were encountered:
You were not doing it wrong! This was a genuine issue. Fixing it took a fair amount of internal rework but there are now tests to cover this use and it should be resolved in v0.3.0. Sorry it took so long to resolve.
Disclaimer: I might very well be doing it wrong.
When trying to spy on a protocol I usually only require the protocol and not :all from the namespace to avoid pollution of the tests namespace. However, with the current implementation of the spy macro I cannot do this. To clarify, this is how the problem is reproducible:
If I require everything from the test1 namespace it works:
Is there a way to make it work? I.e. by taking the namespace into account or prefixing the methods with a dot when generating the proxy calls in the macro?
The text was updated successfully, but these errors were encountered: