View Source Snap (snap_assert v0.1.0)

Provides macros for instant snapshot testing, that is, macros that automatically amend the source code of the test file at their call site with the evaluated value of the expression under test.

Summary

Functions

Modifies the source code of the test file at the call site, adding the evaluated value of arg as the second argument.

With two arguments, snap_assert is equivalent to a regular assert

Modifies the source code of the test file at the call site, adding the exception produced by fun as the first argument (or Snap.UnexpectedLackOfException if no exception is produced).

With two arguments, snap_assert_raise is equivalent to a regular assert_raise

Functions

Link to this macro

snap_assert(arg)

View Source (macro)

Modifies the source code of the test file at the call site, adding the evaluated value of arg as the second argument.

Link to this macro

snap_assert(arg1, arg2)

View Source (macro)

With two arguments, snap_assert is equivalent to a regular assert

Link to this macro

snap_assert_raise(fun)

View Source (macro)

Modifies the source code of the test file at the call site, adding the exception produced by fun as the first argument (or Snap.UnexpectedLackOfException if no exception is produced).

Link to this macro

snap_assert_raise(arg1, arg2)

View Source (macro)

With two arguments, snap_assert_raise is equivalent to a regular assert_raise