Expression.V2.Autodoc (expression v2.23.9)
Extract @expression_doc
attributes from modules defining callbacks
and automatically write doctests for those.
Also inserts an expression_docs()
function which returns a list of
all functions and their defined expression docs.
The format is:
@expression_doc doc: "Construct a date from year, month, and day integers",
expression: "@date(year, month, day)",
context: %{"year" => 2022, "month" => 1, "day" => 31},
result: "2022-01-31T00:00:00Z"
Where:
doc
is the explanatory text added to the doctest.expression
is the expression we want to testcontext
is the context the expression is tested againstresult
is the result we're expecting to get and are asserting againstfake_result
can be optionally supplied when the returning result varies depending on factors we do not control, like fornow()
for example. When this is used, the ExDoc tests are faked and won't actually test anything so use sparingly.
Link to this section Summary
Link to this section Functions
Link to this function
annotate_method(module, function, args)
Link to this function
format_context(context)
Link to this function
format_docs(docs)
Link to this function
format_function_args(args)
Link to this function
format_function_name(name)
Link to this function
format_result(result)
Link to this function
generate_assert(prompt, result)
Link to this function
generate_ex_doc(prompt \\ "iex", module, expression, context, result)
Link to this function
get_existing_docstring(module)
Link to this function
stringify(value)
Link to this function
type_of(boolean)
Link to this function