mirror of
https://github.com/helix-editor/helix
synced 2026-07-28 23:33:35 +02:00
cd6a852c9e
This will be used by the cargo indent-check xtask to validate queries, similar to the existing indent tests in helix-core.
54 lines
766 B
Erlang
54 lines
766 B
Erlang
-module(mymod).
|
|
-export([process/1, classify/1, loop/0]).
|
|
|
|
process(Items) ->
|
|
Total = lists:foldl(
|
|
fun(X, Acc) ->
|
|
X + Acc
|
|
end,
|
|
0,
|
|
Items
|
|
),
|
|
case Total of
|
|
0 ->
|
|
zero;
|
|
_ ->
|
|
many
|
|
end.
|
|
|
|
classify(X) ->
|
|
if
|
|
X > 0 ->
|
|
positive;
|
|
true ->
|
|
other
|
|
end.
|
|
|
|
loop() ->
|
|
receive
|
|
{msg, Data} ->
|
|
handle(Data);
|
|
stop ->
|
|
ok
|
|
end.
|
|
|
|
safe(F) ->
|
|
try F() of
|
|
Result ->
|
|
Result
|
|
catch
|
|
error:Reason ->
|
|
{error, Reason}
|
|
after
|
|
cleanup()
|
|
end.
|
|
|
|
build() ->
|
|
#{
|
|
name => "test",
|
|
items => [
|
|
1,
|
|
2
|
|
]
|
|
}.
|