Skip to content

Conversation

z1lk
Copy link
Contributor

@z1lk z1lk commented Aug 7, 2025

The previous implementation was to assert(!value) which led to confusing failure messages when using refute directly.

For custom failure messages, !value is always false on failure, so false was passed to the custom message block where the caller might instead expect the value that caused the failure.

Similarly, the default failure message was always "expected false to be truthy" when really the expectation is that something truthy is falsy.

The previous implementation was to `assert(!value)` which led to
confusing failure messages when using `refute` directly.

For custom failure messages, `!value` is always `false` on failure, so
`false` is passed to the custom message block where the caller might
instead expect the value that caused the failure.

Similarly, the default failure message is always "expected false to be
truthy" when really the expectation is that something truthy is falsy.
@z1lk z1lk force-pushed the improve-refute-message branch from c4e3952 to 9039716 Compare August 7, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant