dream_test/matchers/equality
Equality matchers for dream_test.
These matchers compare values using Gleam’s structural equality.
They’re re-exported through dream_test/assertions/should.
Usage
import dream_test/assertions/should.{should, equal, not_equal, or_fail_with}
// Check equality
result
|> should()
|> equal(42)
|> or_fail_with("Should be 42")
// Check inequality
result
|> should()
|> not_equal(0)
|> or_fail_with("Should not be zero")
Values
pub fn equal(
value_or_result: types.MatchResult(a),
expected: a,
) -> types.MatchResult(a)
Assert that a value equals the expected value.
Uses Gleam’s structural equality (==). Works with any type that
supports equality comparison.
Example
add(2, 3)
|> should()
|> equal(5)
|> or_fail_with("2 + 3 should equal 5")
pub fn not_equal(
value_or_result: types.MatchResult(a),
unexpected: a,
) -> types.MatchResult(a)
Assert that a value does not equal the unexpected value.
Uses Gleam’s structural inequality (!=).
Example
divide(10, 3)
|> should()
|> not_equal(3)
|> or_fail_with("10/3 should not equal 3 exactly")