KogenCredo.CoreSupport.Tests (KogenCredo v0.1.0)

View Source

ExUnit-source helpers shared by the test-quality checks.

A test block is a test "name" do ... end call; an assertion is a call to assert, refute, assert_* or refute_*. This is purely name-based.

Summary

Functions

Name-based assertion test.

Assertion calls in the AST as {name, args, meta}.

All test blocks with a body, as %{name: ast, meta: keyword, body: ast}.

True when the filename ends with one of the suffixes (default test file suffix is _test.exs).

Unwraps a trailing {:__block__, _, [expr]}.

Functions

assertion_name?(name)

@spec assertion_name?(atom()) :: boolean()

Name-based assertion test.

assertions(ast)

@spec assertions(Macro.t()) :: [{atom(), [Macro.t()], keyword()}]

Assertion calls in the AST as {name, args, meta}.

test_blocks(ast, macros \\ [:test])

@spec test_blocks(Macro.t(), [atom()]) :: [map()]

All test blocks with a body, as %{name: ast, meta: keyword, body: ast}.

test_file?(filename, suffixes)

@spec test_file?(String.t(), [String.t()]) :: boolean()

True when the filename ends with one of the suffixes (default test file suffix is _test.exs).

unwrap(other)

@spec unwrap(Macro.t()) :: Macro.t()

Unwraps a trailing {:__block__, _, [expr]}.