Add support for assertions
complete
D
David
Sometimes, I add expected totals partway down a page. If I have errors in calculations, then periodic assertions helps me isolate where calculations have gone awry. Something like
assert total = 1234
. It would be especially useful if it could be used in conjunction with subtotal lines. I was picturing something like Python's assert statement (https://realpython.com/python-assert-statement/#understanding-pythons-assert-statements) but I'm not picky about the exact syntax.I can sort of do this with the boolean comparisons, but it would be nice to have those light up red if the assertion fails (rather than just showing "false", which doesn't stand out much). Something like a❗in the answer pane would be great.
Thank you!
Zac @ Soulver
complete
This feature was released in Soulver 3.9.2
D
David
amazing! Thank you for doing that.
Zac @ Soulver
under review
Interesting feature request David, thank you.
Zac @ Soulver
Something like this David?
D
David
Zac @ Soulver: Yeah, that's great!
I think in a perfect world, the passed assertion wouldn't have any output on the right (like a heading or a comment) and the failed assertion would show both sides of the comparison (e.g. "‼️ 1,200 != 1,234"), though that might be tricky for more complex comparisons.
But, you know best how the UX of the app should work, so follow you heart. Thank you so much for working on this!
Zac @ Soulver
David: Yeah, I like that idea that they work like assertions in code (succeed silently, but fail loudly with some context).
I can print the variable value fairly easily in a failed assertion.