zachallaun/mneme

Add auto_refute

Closed this issue · 2 comments

This would rarely be used directly but instead would be a sort of “shorthand” for auto-assertions that return a falsy value.

Currently:

auto_assert Function.identity(nil)

# results in
auto_assert Function.identity(nil) == nil

Proposed:

auto_assert Function.identity(nil)

# results in
auto_refute Function.identity(nil)

If the expression ever stopped returning a falsy value, it would prompt to change back to an auto_assert.

I'm now weighing the option of not introducing auto_refute and instead changing the semantics of auto_assert such that the following passes:

auto_assert nil <- Function.identity(nil)

If you were to translate that directly into an ExUnit assertion, it would fail, because assert requires the result to be truthy. We inherited that with auto_assert, but I'm considering changing it. This would simplify auto_assert, removing support for == comparisons.

Closed in favor of 1c754bf