ExExample.Executor (ExExample v0.1.2)

View Source

I contain functionality to execute examples.

I contain logic to determine if a cachd result should be used, computation should be done again, or if an example should be skipped.

Summary

Functions

I attempt to run an example.

Given an example, I return a hash of all its dependencies. This hash can be used to determine of an example was run with an older version of a dependency.

Given an example, I return a map of all its dependencies that failed, succeeded, were skipped, or have not run yet.

Given an example, I return a hash of all its dependencies. This hash can be used to determine of an example was run with an older version of a dependency.

I return the last known result of an example invocation. If the example has not been run yet I return an error.

I run all the examples in the given module. I use the cache for each invocation.

I run an example directly. I do not consult the cache for a previous result. I return a result of this execution and put it in the cache.

I run an example with the cached results. If there is cached result, I return that. If there is no result in the cache I run the example.

Functions

attempt_example(arg, arguments)

@spec attempt_example(
  {atom(), atom()},
  [any()]
) :: ExExample.Run.t()

I attempt to run an example.

I return a struct that holds the result, the key, and a list of all the dependencies and their previous result.

dependency_hash(arg)

@spec dependency_hash({atom(), atom()}) :: non_neg_integer()

Given an example, I return a hash of all its dependencies. This hash can be used to determine of an example was run with an older version of a dependency.

dependency_results(arg)

@spec dependency_results({atom(), atom()}) :: %{
  success: [ExExample.dependency()],
  skipped: [ExExample.dependency()],
  failed: [ExExample.dependency()],
  no_cache: [ExExample.dependency()]
}

Given an example, I return a map of all its dependencies that failed, succeeded, were skipped, or have not run yet.

deps_hash(dependencies)

@spec deps_hash([ExExample.dependency()]) :: non_neg_integer()

Given an example, I return a hash of all its dependencies. This hash can be used to determine of an example was run with an older version of a dependency.

last_result(arg)

@spec last_result(ExExample.dependency()) :: :success | :skipped | :failed | :no_cache

I return the last known result of an example invocation. If the example has not been run yet I return an error.

pretty_run(module)

@spec pretty_run(atom()) :: :ok

run_all_examples(module)

@spec run_all_examples(atom()) :: [ExExample.Run.t()]

I run all the examples in the given module. I use the cache for each invocation.

run_example(arg, arguments)

@spec run_example(
  {atom(), atom()},
  [any()]
) :: ExExample.Cache.Result.t()

I run an example directly. I do not consult the cache for a previous result. I return a result of this execution and put it in the cache.

run_example_with_cache(arg, arguments)

@spec run_example_with_cache(
  {atom(), atom()},
  [any()]
) :: ExExample.Cache.Result.t()

I run an example with the cached results. If there is cached result, I return that. If there is no result in the cache I run the example.