Stream: ideas

Topic: Inspect x and y when `expect x == y` fails


view this post on Zulip Aurélien Geron (Aug 17 2026 at 00:03):

Many expects look like expect x == y. When the test fails, it's usually useful to know what the actual values are, if they are safe to inspect. It would be nice to display a message like Expected x == y, but x == 42, and y == 43.
I vaguely remember this being the case in the old compiler, so perhaps this has been discussed before and you decided that adding dbg x and dbg y wasn't a big deal? That said, we don't always have access to the code where the expect lives, such as in Exercism.

If we do go ahead with this, then we'd need the same thing for <=, >=, !=, and perhaps a few more common use cases.

view this post on Zulip Richard Feldman (Aug 17 2026 at 00:19):

yeah it just hasn't been implemented yet

view this post on Zulip Richard Feldman (Aug 17 2026 at 00:20):

the actual thing I want to do is to break down the entire expression and show all the subexpressions, as well as all the identifiers that were used in it

view this post on Zulip Richard Feldman (Aug 17 2026 at 00:21):

so like if you do

expect foo.bar().baz().is_thing(blah)

then it would print something like:

foo == 42
foo.bar() == "something"
foo.bar().baz() == 123
blah == "stuff"
foo.bar().baz().is_thing(blah) == False

view this post on Zulip Richard Feldman (Aug 17 2026 at 00:22):

so operators like == wouldn't be special-cased at all, it would just give you all the info so a lot of the time you don't have to go back and dbg things

view this post on Zulip Aurélien Geron (Aug 17 2026 at 00:22):

Even better! :roc:

view this post on Zulip Richard Feldman (Aug 17 2026 at 00:22):

yeah just haven't done it yet :laughing:


Last updated: Sep 03 2026 at 15:16 UTC