Roux.Code.Verify (roux v0.2.2)

Copy Markdown View Source

What a computation actually runs, for a test that checks a closure (Roux.Code.closure/2) against it: every module the computation executes must be in the closure of the roots its code version is made of, or an edit to that module would leave stale results in place.

{_result, ran} = Roux.Code.Verify.executed(fn -> MyGraph.extract(db, key) end)
{:ok, closure} = Roux.Code.closure([MyGraph.Extraction])
assert ran -- Enum.map(closure, &elem(&1, 0)) == []

Call counts are kept per VM, not per process: anything else the VM runs meanwhile counts too. Run it in a VM of its own (:peer).

Summary

Functions

Runs fun with call counting on, and returns its result with the modules it called into, sorted.

Functions

executed(fun, opts \\ [])

@spec executed(
  (-> result),
  keyword()
) :: {result, [module()]}
when result: var

Runs fun with call counting on, and returns its result with the modules it called into, sorted.

Options

  • :modules — the modules to watch (default: every module of every loaded application that is not OTP's or Elixir's). A module is loaded before the run, since only loaded code can be counted.