I published "Applying Kotlin context receivers". ...
# feed
y
I published "Applying Kotlin context receivers". Let's see how context receivers could be used to implement stuffs like Jetpack compose Modifier. https://proandroiddev.com/applying-kotlin-context-receivers-5f2ad2ec4043
🎉 6
👍 1
d
Nice article! How did you test/mock the code with context receivers? Because I also tried to use them and while the feature itself works nicely I couldn't reliably mock the methods with context receivers (using mockk in my case).
🤔 1
y
That's an interesting question 🤔 I'll try to investigate. I am wondering in what situation you can have to mock something that must be used within a particular context outside of it.
But you can still use the
with
operator
d
Well, I tried that in the past and even created an issue: https://github.com/mockk/mockk/issues/995. I just wondered whether you didn't come up with some clever workaround 🙂