so, I rememeber being part of a scala reading grou...
# announcements
g
so, I rememeber being part of a scala reading group and listening to them talk about automatically generating tests to verify things like monad laws. If you declared your type was a monad, it was relatively simple to add tooling to verify that it adhere'd to monadic properties. That seemed a little too theoretical to be useful, but I really liked the idea: if you followed some idiom you can get test coverage for free (or for cheap). I just fixed the latest in a long line of
Closeable
.close()
not called
style bugs. Unfortunately idiomatically using
.use{}
or try-finally (or, RAII had i been on C++) is not possible, because these
close()
calls relate to UI elements on binding logic. There are some fairly simple assertions I can make. "Given a ui component X has a constructor annotated with
@Inject
, and that constructor has members Y that themselves have a
dispose()
method, then calling
X.dispose()
should call
Y.foreach { it.dispose() }
. Anyone have ideas on how I might write a test-harness to let me quickly do that, instead of manually creating mocks and verifying behaviours etc?