bnorm
06/09/2024, 3:44 PMapp.loadStockList()
are indeed the implicit receivers. If you would like to open an issue about that we can look into either ignoring implicit receivers or explicitly labeling them.
2. In your example with valueOrNull?.items?.size ?: 0
on the right hand side of a comparison where you didn't get any nested values, I think this is due to the elvis operator. Would appreciate an issue being opened for this example, as we should be able to handle it better.
3. Multiline toString()
of values within the expression are indeed a display problem. The message template is built at compile-time, so there isn't any special handling of more complex values. This can make the display rather ugly in these cases, but we have some plans in this area: https://youtrack.jetbrains.com/issue/KT-66807. You are welcome to open a separate issue though if you have ideas on how we could better handle this specific case.
4. For boolean short-circuiting, if the conditions don't relate to each other but you want to combine them, you can use the and
and or
boolean infix functions (instead of &&
and ||
) which do not short-circuit. (Note: you may need to add some ()
in the right places to get things working correctly)
5. For the soft-assert example, the sample assertSoftly
code could be updated to also display successful assertions as well. The assert
function is always called with the call diagram. So it is really up to the called function to decided what to do with the call digram (message of exception, log to stdout, etc). This could allow successful assertions to be displayed as well when there is a failure for Strikt like behavior.
6. And finally, my general recommendation is use assertEquals
whenever possible and assertTrue
as a fall-back for more general checks (both configured for power-assert, of course). This ordering gives you the best IDE integration for diffs.dmcg
06/10/2024, 6:55 AMdmcg
06/10/2024, 6:57 AMdmcg
06/10/2024, 7:53 PM