Ex Contract v0.1.0 ExContract View Source

This is Elixir library application that adds support for design by contract. For intro to DbC methodology see DbC.

Link to this section Summary

Functions

This macros handles function definitions that contain implicit try block that is followed by rescue, after, or catch. Example:

def without_even_trying do
  raise "oops"
after
  IO.puts "cleaning up!"
end

In this case the macro receives AST for body of this form:

[do: {...}, rescue: [...]]

The same as def macro except supports requires and ensures for private functions with implicit try block

Link to this section Types

Link to this type t_ast() View Source
t_ast() :: tuple | [any] | any

Link to this section Functions

Link to this macro check(condition) View Source (macro)
Link to this macro check(condition, msg) View Source (macro)
Link to this macro def(definition, body) View Source (macro)

This macros handles function definitions that contain implicit try block that is followed by rescue, after, or catch. Example:

def without_even_trying do
  raise "oops"
after
  IO.puts "cleaning up!"
end

In this case the macro receives AST for body of this form:

[do: {...}, rescue: [...]]
Link to this function def_implicit_try_imp(list) View Source
def_implicit_try_imp(list) :: t_ast
Link to this macro defp(definition, body) View Source (macro)

The same as def macro except supports requires and ensures for private functions with implicit try block.

Link to this macro ensures(condition) View Source (macro)
Link to this macro ensures(condition, msg) View Source (macro)
Link to this macro requires(condition) View Source (macro)
Link to this macro requires(condition, msg) View Source (macro)