zio / zio-mock

https://zio.dev/zio-mock
Apache License 2.0
27 stars 33 forks source link

scala 3 support #13

Open senia-psm opened 2 years ago

senia-psm commented 2 years ago

Current implementation relies on scala 2 annotation macros.

There is no way to generate new methods/objects with scala 3 macros, so the current approach is not applicable to scala 3.

Additionally current approach relies on Assertion which is a subject for deprecation.

1 possible solution is to create something similar to ScalaMock:

val expect = (mock[Srv].method(_, _, _)).expect((a, b, c)=> assertTrue(a == 1, b == "", c < 0)).returns(valueF(_ => ???)).atMost(0)

val lessVerbose = mock[Srv](_.method _).assertParams(_ == 1, _ == "", _ < 0).returnF(_ => ???).atMost(0)
goshacodes commented 2 months ago

Hi! I've created a stubbing library for scala 3 and probably it can replace zio-mock https://github.com/goshacodes/backstub