Current section
Files
Jump to
Current section
Files
src/startest@test_case.erl
-module(startest@test_case).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([decode_test/1]).
-export_type([test/0, test_outcome/0, executed_test/0]).
-type test() :: {test, binary(), fun(() -> nil), boolean()}.
-type test_outcome() :: passed |
{failed, startest@test_failure:test_failure()} |
skipped.
-type executed_test() :: {executed_test, test(), test_outcome()}.
-spec decode_test_body(gleam@dynamic:dynamic_()) -> {ok, fun(() -> nil)} |
{error, list(gleam@dynamic:decode_error())}.
decode_test_body(Value) ->
Function = gleam@dynamic:unsafe_coerce(Value),
{ok, Function}.
-spec decode_test(gleam@dynamic:dynamic_()) -> {ok, test()} |
{error, list(gleam@dynamic:decode_error())}.
decode_test(Value) ->
_pipe = Value,
(gleam@dynamic:decode3(
fun(Field@0, Field@1, Field@2) -> {test, Field@0, Field@1, Field@2} end,
gleam@dynamic:element(1, fun gleam@dynamic:string/1),
gleam@dynamic:element(2, fun decode_test_body/1),
gleam@dynamic:element(3, fun gleam@dynamic:bool/1)
))(_pipe).