Flow Assertions v0.1.0 FlowAssertions.Define.AssertionError View Source

Functions that allow a little more control over what people see when tests fail.

Link to this section Summary

Functions

A variant of ExUnit.Assertions.assert/2 that gives more control over what's shown in a failing test by letting you set ExUnit.AssertionError values like :left and :right.

This replicates the diagnostic output from assert a == b.

A variant of ExUnit.Assertions.flunk/1 that gives more control over what's shown in a failing test by letting you set ExUnit.AssertionError values like :left and :right.

Link to this section Functions

Link to this function

adjust_assertion_error(f, replacements)

View Source
Link to this function

elaborate_assert(value, message, opts)

View Source

A variant of ExUnit.Assertions.assert/2 that gives more control over what's shown in a failing test by letting you set ExUnit.AssertionError values like :left and :right.

  elaborate_assert(
    left =~ right,
    "Regular expression didn't match",
    left: left, right: right)

Warning: as far as I know, the structure of ExUnit.AssertionError is not guaranteed to be stable.

See also elaborate_assert/3.

Link to this function

elaborate_assert_equal(left, right)

View Source

This replicates the diagnostic output from assert a == b.

Link to this function

elaborate_flunk(message, opts)

View Source

A variant of ExUnit.Assertions.flunk/1 that gives more control over what's shown in a failing test by letting you set ExUnit.AssertionError values like :left and :right.

elaborate_flunk("the value is wrong", left: value_to_check)

Warning: as far as I know, the structure of ExUnit.AssertionError is not guaranteed to be stable.

See also elaborate_assert/3.