aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-07-03 09:50:21 +0100
committerLouis Pilfold <louis@lpil.uk>2019-07-03 09:53:25 +0100
commitfa47fcb49980b1b1a2b2982389006345658bae79 (patch)
tree4c168df0a645ed7db2e06aadfbbdbd0a1d0aa9bf
parent02fd6d96e60d1a578193744a7799178755e37fde (diff)
downloadgleam_stdlib-fa47fcb49980b1b1a2b2982389006345658bae79.tar.gz
gleam_stdlib-fa47fcb49980b1b1a2b2982389006345658bae79.zip
Improve erl formatting
-rw-r--r--gen/src/gleam@any.erl8
-rw-r--r--gen/src/gleam@string.erl12
-rw-r--r--gen/src/gleam@tuple.erl10
-rw-r--r--gen/test/gleam@any_test.erl200
-rw-r--r--gen/test/gleam@atom_test.erl40
-rw-r--r--gen/test/gleam@iodata_test.erl105
-rw-r--r--gen/test/gleam@list_test.erl188
-rw-r--r--gen/test/gleam@map_dict_test.erl200
-rw-r--r--gen/test/gleam@result_test.erl56
-rw-r--r--gen/test/gleam@string_test.erl26
10 files changed, 512 insertions, 333 deletions
diff --git a/gen/src/gleam@any.erl b/gen/src/gleam@any.erl
index a81a836..c04aae4 100644
--- a/gen/src/gleam@any.erl
+++ b/gen/src/gleam@any.erl
@@ -31,10 +31,10 @@ list_any(A) ->
gleam__stdlib:decode_list(A).
list(Any, Decode) ->
- gleam@result:then(list_any(Any),
- fun(Capture1) ->
- gleam@list:traverse(Capture1, Decode)
- end).
+ gleam@result:then(
+ list_any(Any),
+ fun(Capture1) -> gleam@list:traverse(Capture1, Decode) end
+ ).
tuple(A) ->
gleam__stdlib:decode_tuple(A).
diff --git a/gen/src/gleam@string.erl b/gen/src/gleam@string.erl
index 144d866..00643c3 100644
--- a/gen/src/gleam@string.erl
+++ b/gen/src/gleam@string.erl
@@ -16,13 +16,15 @@ reverse(String) ->
gleam@iodata:to_string(gleam@iodata:reverse(gleam@iodata:new(String))).
split(String, On) ->
- gleam@list:map(gleam@iodata:split(gleam@iodata:new(String), On),
- fun gleam@iodata:to_string/1).
+ gleam@list:map(
+ gleam@iodata:split(gleam@iodata:new(String), On),
+ fun gleam@iodata:to_string/1
+ ).
replace(String, Pattern, With) ->
- gleam@iodata:to_string(gleam@iodata:replace(gleam@iodata:new(String),
- Pattern,
- With)).
+ gleam@iodata:to_string(
+ gleam@iodata:replace(gleam@iodata:new(String), Pattern, With)
+ ).
append(S1, S2) ->
gleam@iodata:to_string(gleam@iodata:append(gleam@iodata:new(S1), S2)).
diff --git a/gen/src/gleam@tuple.erl b/gen/src/gleam@tuple.erl
index 1e236bf..30c553c 100644
--- a/gen/src/gleam@tuple.erl
+++ b/gen/src/gleam@tuple.erl
@@ -20,9 +20,9 @@ swap(Tup) ->
fetch(Haystack, Needle) ->
gleam@list:find(Haystack, fun(Tuple) -> case first(Tuple) =:= Needle of
- true ->
- {ok, second(Tuple)};
+ true ->
+ {ok, second(Tuple)};
- false ->
- {error, []}
- end end).
+ false ->
+ {error, []}
+ end end).
diff --git a/gen/test/gleam@any_test.erl b/gen/test/gleam@any_test.erl
index db6973f..a9be88e 100644
--- a/gen/test/gleam@any_test.erl
+++ b/gen/test/gleam@any_test.erl
@@ -5,36 +5,52 @@
string_test() ->
gleam@expect:equal(gleam@any:string(gleam@any:from(<<"">>)), {ok, <<"">>}),
- gleam@expect:equal(gleam@any:string(gleam@any:from(<<"Hello">>)),
- {ok, <<"Hello">>}),
- gleam@expect:equal(gleam@any:string(gleam@any:from(1)),
- {error, <<"Expected a String, got `1`">>}),
- gleam@expect:equal(gleam@any:string(gleam@any:from([])),
- {error, <<"Expected a String, got `[]`">>}).
+ gleam@expect:equal(
+ gleam@any:string(gleam@any:from(<<"Hello">>)),
+ {ok, <<"Hello">>}
+ ),
+ gleam@expect:equal(
+ gleam@any:string(gleam@any:from(1)),
+ {error, <<"Expected a String, got `1`">>}
+ ),
+ gleam@expect:equal(
+ gleam@any:string(gleam@any:from([])),
+ {error, <<"Expected a String, got `[]`">>}
+ ).
int_test() ->
gleam@expect:equal(gleam@any:int(gleam@any:from(1)), {ok, 1}),
gleam@expect:equal(gleam@any:int(gleam@any:from(2)), {ok, 2}),
- gleam@expect:equal(gleam@any:int(gleam@any:from(1.0)),
- {error, <<"Expected an Int, got `1.0`">>}),
- gleam@expect:equal(gleam@any:int(gleam@any:from([])),
- {error, <<"Expected an Int, got `[]`">>}).
+ gleam@expect:equal(
+ gleam@any:int(gleam@any:from(1.0)),
+ {error, <<"Expected an Int, got `1.0`">>}
+ ),
+ gleam@expect:equal(
+ gleam@any:int(gleam@any:from([])),
+ {error, <<"Expected an Int, got `[]`">>}
+ ).
float_test() ->
gleam@expect:equal(gleam@any:float(gleam@any:from(1.0)), {ok, 1.0}),
gleam@expect:equal(gleam@any:float(gleam@any:from(2.2)), {ok, 2.2}),
- gleam@expect:equal(gleam@any:float(gleam@any:from(1)),
- {error, <<"Expected a Float, got `1`">>}),
- gleam@expect:equal(gleam@any:float(gleam@any:from([])),
- {error, <<"Expected a Float, got `[]`">>}).
+ gleam@expect:equal(
+ gleam@any:float(gleam@any:from(1)),
+ {error, <<"Expected a Float, got `1`">>}
+ ),
+ gleam@expect:equal(
+ gleam@any:float(gleam@any:from([])),
+ {error, <<"Expected a Float, got `[]`">>}
+ ).
thunk_test() ->
gleam@expect:is_ok(gleam@any:thunk(gleam@any:from(fun() -> 1 end))),
- gleam@expect:equal(gleam@result:map(gleam@any:thunk(gleam@any:from(fun() ->
- 1
- end)),
- fun(F) -> F() end),
- {ok, gleam@any:from(1)}),
+ gleam@expect:equal(
+ gleam@result:map(
+ gleam@any:thunk(gleam@any:from(fun() -> 1 end)),
+ fun(F) -> F() end
+ ),
+ {ok, gleam@any:from(1)}
+ ),
gleam@expect:is_error(gleam@any:thunk(gleam@any:from(fun(X) -> X end))),
gleam@expect:is_error(gleam@any:thunk(gleam@any:from(1))),
gleam@expect:is_error(gleam@any:thunk(gleam@any:from([]))).
@@ -42,77 +58,107 @@ thunk_test() ->
bool_test() ->
gleam@expect:equal(gleam@any:bool(gleam@any:from(true)), {ok, true}),
gleam@expect:equal(gleam@any:bool(gleam@any:from(false)), {ok, false}),
- gleam@expect:equal(gleam@any:bool(gleam@any:from(1)),
- {error, <<"Expected a Bool, got `1`">>}),
- gleam@expect:equal(gleam@any:bool(gleam@any:from([])),
- {error, <<"Expected a Bool, got `[]`">>}).
+ gleam@expect:equal(
+ gleam@any:bool(gleam@any:from(1)),
+ {error, <<"Expected a Bool, got `1`">>}
+ ),
+ gleam@expect:equal(
+ gleam@any:bool(gleam@any:from([])),
+ {error, <<"Expected a Bool, got `[]`">>}
+ ).
atom_test() ->
- gleam@expect:equal(gleam@any:atom(gleam@any:from(gleam@atom:create_from_string(<<"">>))),
- {ok, gleam@atom:create_from_string(<<"">>)}),
- gleam@expect:equal(gleam@any:atom(gleam@any:from(gleam@atom:create_from_string(<<"ok">>))),
- {ok, gleam@atom:create_from_string(<<"ok">>)}),
+ gleam@expect:equal(
+ gleam@any:atom(gleam@any:from(gleam@atom:create_from_string(<<"">>))),
+ {ok, gleam@atom:create_from_string(<<"">>)}
+ ),
+ gleam@expect:equal(
+ gleam@any:atom(gleam@any:from(gleam@atom:create_from_string(<<"ok">>))),
+ {ok, gleam@atom:create_from_string(<<"ok">>)}
+ ),
gleam@expect:is_error(gleam@any:atom(gleam@any:from(1))),
gleam@expect:is_error(gleam@any:atom(gleam@any:from([]))).
list_test() ->
- gleam@expect:equal(gleam@any:list(gleam@any:from([]),
- fun gleam@any:string/1),
- {ok, []}),
- gleam@expect:equal(gleam@any:list(gleam@any:from([]), fun gleam@any:int/1),
- {ok, []}),
- gleam@expect:equal(gleam@any:list(gleam@any:from([1, 2, 3]),
- fun gleam@any:int/1),
- {ok, [1, 2, 3]}),
- gleam@expect:equal(gleam@any:list(gleam@any:from([[1], [2], [3]]),
- fun(Capture1) ->
- gleam@any:list(Capture1,
- fun gleam@any:int/1)
- end),
- {ok, [[1], [2], [3]]}),
- gleam@expect:is_error(gleam@any:list(gleam@any:from(1),
- fun gleam@any:string/1)),
- gleam@expect:is_error(gleam@any:list(gleam@any:from(1.0),
- fun gleam@any:int/1)),
- gleam@expect:is_error(gleam@any:list(gleam@any:from([<<"">>]),
- fun gleam@any:int/1)),
- gleam@expect:is_error(gleam@any:list(gleam@any:from([gleam@any:from(1),
- gleam@any:from(<<"not an int">>)]),
- fun gleam@any:int/1)).
+ gleam@expect:equal(
+ gleam@any:list(gleam@any:from([]), fun gleam@any:string/1),
+ {ok, []}
+ ),
+ gleam@expect:equal(
+ gleam@any:list(gleam@any:from([]), fun gleam@any:int/1),
+ {ok, []}
+ ),
+ gleam@expect:equal(
+ gleam@any:list(gleam@any:from([1, 2, 3]), fun gleam@any:int/1),
+ {ok, [1, 2, 3]}
+ ),
+ gleam@expect:equal(
+ gleam@any:list(
+ gleam@any:from([[1], [2], [3]]),
+ fun(Capture1) -> gleam@any:list(Capture1, fun gleam@any:int/1) end
+ ),
+ {ok, [[1], [2], [3]]}
+ ),
+ gleam@expect:is_error(
+ gleam@any:list(gleam@any:from(1), fun gleam@any:string/1)
+ ),
+ gleam@expect:is_error(
+ gleam@any:list(gleam@any:from(1.0), fun gleam@any:int/1)
+ ),
+ gleam@expect:is_error(
+ gleam@any:list(gleam@any:from([<<"">>]), fun gleam@any:int/1)
+ ),
+ gleam@expect:is_error(
+ gleam@any:list(
+ gleam@any:from(
+ [gleam@any:from(1), gleam@any:from(<<"not an int">>)]
+ ),
+ fun gleam@any:int/1
+ )
+ ).
tuple_test() ->
- gleam@expect:equal(gleam@any:tuple(gleam@any:from({1, []})),
- {ok, {gleam@any:from(1), gleam@any:from([])}}),
- gleam@expect:equal(gleam@any:tuple(gleam@any:from({<<"ok">>, <<"ok">>})),
- {ok,
- {gleam@any:from(<<"ok">>), gleam@any:from(<<"ok">>)}}),
+ gleam@expect:equal(
+ gleam@any:tuple(gleam@any:from({1, []})),
+ {ok, {gleam@any:from(1), gleam@any:from([])}}
+ ),
+ gleam@expect:equal(
+ gleam@any:tuple(gleam@any:from({<<"ok">>, <<"ok">>})),
+ {ok, {gleam@any:from(<<"ok">>), gleam@any:from(<<"ok">>)}}
+ ),
gleam@expect:is_error(gleam@any:tuple(gleam@any:from({1}))),
gleam@expect:is_error(gleam@any:tuple(gleam@any:from({1, 2, 3}))),
- gleam@expect:equal(gleam@result:then(gleam@result:then(gleam@any:tuple(gleam@any:from({1,
- 2.0})),
- fun(X) ->
- gleam@result:map(gleam@any:int(gleam@tuple:first(X)),
- fun(F) ->
- {F,
- gleam@tuple:second(X)}
- end)
- end),
- fun(X) ->
- gleam@result:map(gleam@any:float(gleam@tuple:second(X)),
- fun(F) ->
- {gleam@tuple:first(X),
- F}
- end)
- end),
- {ok, {1, 2.0}}).
+ gleam@expect:equal(
+ gleam@result:then(
+ gleam@result:then(
+ gleam@any:tuple(gleam@any:from({1, 2.0})),
+ fun(X) ->
+ gleam@result:map(
+ gleam@any:int(gleam@tuple:first(X)),
+ fun(F) -> {F, gleam@tuple:second(X)} end
+ )
+ end
+ ),
+ fun(X) ->
+ gleam@result:map(
+ gleam@any:float(gleam@tuple:second(X)),
+ fun(F) -> {gleam@tuple:first(X), F} end
+ )
+ end
+ ),
+ {ok, {1, 2.0}}
+ ).
field_test() ->
{ok, OkAtom} = gleam@atom:from_string(<<"ok">>),
- gleam@expect:equal(gleam@any:field(gleam@any:from(#{}#{ok => 1}), OkAtom),
- {ok, gleam@any:from(1)}),
- gleam@expect:equal(gleam@any:field(gleam@any:from(#{}#{ok => 3}#{earlier => 2}),
- OkAtom),
- {ok, gleam@any:from(3)}),
+ gleam@expect:equal(
+ gleam@any:field(gleam@any:from(#{}#{ok => 1}), OkAtom),
+ {ok, gleam@any:from(1)}
+ ),
+ gleam@expect:equal(
+ gleam@any:field(gleam@any:from(#{}#{ok => 3}#{earlier => 2}), OkAtom),
+ {ok, gleam@any:from(3)}
+ ),
gleam@expect:is_error(gleam@any:field(gleam@any:from(#{}), OkAtom)),
gleam@expect:is_error(gleam@any:field(gleam@any:from(1), OkAtom)),
gleam@expect:is_error(gleam@any:field(gleam@any:from([]), [])).
diff --git a/gen/test/gleam@atom_test.erl b/gen/test/gleam@atom_test.erl
index d9c429c..84b361f 100644
--- a/gen/test/gleam@atom_test.erl
+++ b/gen/test/gleam@atom_test.erl
@@ -6,19 +6,35 @@
from_string_test() ->
gleam@expect:is_ok(gleam@atom:from_string(<<"ok">>)),
gleam@expect:is_ok(gleam@atom:from_string(<<"expect">>)),
- gleam@expect:is_error(gleam@atom:from_string(<<"this is not an atom we have seen before">>)).
+ gleam@expect:is_error(
+ gleam@atom:from_string(<<"this is not an atom we have seen before">>)
+ ).
create_from_string_test() ->
- gleam@expect:equal({ok, gleam@atom:create_from_string(<<"ok">>)},
- gleam@atom:from_string(<<"ok">>)),
- gleam@expect:equal({ok, gleam@atom:create_from_string(<<"expect">>)},
- gleam@atom:from_string(<<"expect">>)),
- gleam@expect:equal({ok,
- gleam@atom:create_from_string(<<"this is another atom we have not seen before">>)},
- gleam@atom:from_string(<<"this is another atom we have not seen before">>)).
+ gleam@expect:equal(
+ {ok, gleam@atom:create_from_string(<<"ok">>)},
+ gleam@atom:from_string(<<"ok">>)
+ ),
+ gleam@expect:equal(
+ {ok, gleam@atom:create_from_string(<<"expect">>)},
+ gleam@atom:from_string(<<"expect">>)
+ ),
+ gleam@expect:equal(
+ {ok,
+ gleam@atom:create_from_string(
+ <<"this is another atom we have not seen before">>
+ )},
+ gleam@atom:from_string(
+ <<"this is another atom we have not seen before">>
+ )
+ ).
to_string_test() ->
- gleam@expect:equal(gleam@atom:to_string(gleam@atom:create_from_string(<<"ok">>)),
- <<"ok">>),
- gleam@expect:equal(gleam@atom:to_string(gleam@atom:create_from_string(<<"expect">>)),
- <<"expect">>).
+ gleam@expect:equal(
+ gleam@atom:to_string(gleam@atom:create_from_string(<<"ok">>)),
+ <<"ok">>
+ ),
+ gleam@expect:equal(
+ gleam@atom:to_string(gleam@atom:create_from_string(<<"expect">>)),
+ <<"expect">>
+ ).
diff --git a/gen/test/gleam@iodata_test.erl b/gen/test/gleam@iodata_test.erl
index 621266c..8d8e989 100644
--- a/gen/test/gleam@iodata_test.erl
+++ b/gen/test/gleam@iodata_test.erl
@@ -4,55 +4,90 @@
-export([iodata_test/0, lowercase_test/0, uppercase_test/0, split_test/0, is_equal_test/0, is_empty_test/0]).
iodata_test() ->
- Data = gleam@iodata:prepend(gleam@iodata:append(gleam@iodata:append(gleam@iodata:new(<<"ello">>),
- <<",">>),
- <<" world!">>),
- <<"H">>),
+ Data = gleam@iodata:prepend(
+ gleam@iodata:append(
+ gleam@iodata:append(gleam@iodata:new(<<"ello">>), <<",">>),
+ <<" world!">>
+ ),
+ <<"H">>
+ ),
gleam@expect:equal(gleam@iodata:to_string(Data), <<"Hello, world!">>),
gleam@expect:equal(gleam@iodata:byte_size(Data), 13),
- Data1 = gleam@iodata:prepend_iodata(gleam@iodata:append_iodata(gleam@iodata:append_iodata(gleam@iodata:new(<<"ello">>),
- gleam@iodata:new(<<",">>)),
- gleam@iodata:concat([gleam@iodata:new(<<" wo">>),
- gleam@iodata:new(<<"rld!">>)])),
- gleam@iodata:new(<<"H">>)),
+ Data1 = gleam@iodata:prepend_iodata(
+ gleam@iodata:append_iodata(
+ gleam@iodata:append_iodata(
+ gleam@iodata:new(<<"ello">>),
+ gleam@iodata:new(<<",">>)
+ ),
+ gleam@iodata:concat(
+ [gleam@iodata:new(<<" wo">>), gleam@iodata:new(<<"rld!">>)]
+ )
+ ),
+ gleam@iodata:new(<<"H">>)
+ ),
gleam@expect:equal(gleam@iodata:to_string(Data1), <<"Hello, world!">>),
gleam@expect:equal(gleam@iodata:byte_size(Data1), 13).
lowercase_test() ->
- gleam@expect:equal(gleam@iodata:to_string(gleam@iodata:lowercase(gleam@iodata:from_strings([<<"Gleam">>,
- <<"Gleam">>]))),
- <<"gleamgleam">>).
+ gleam@expect:equal(
+ gleam@iodata:to_string(
+ gleam@iodata:lowercase(
+ gleam@iodata:from_strings([<<"Gleam">>, <<"Gleam">>])
+ )
+ ),
+ <<"gleamgleam">>
+ ).
uppercase_test() ->
- gleam@expect:equal(gleam@iodata:to_string(gleam@iodata:uppercase(gleam@iodata:from_strings([<<"Gleam">>,
- <<"Gleam">>]))),
- <<"GLEAMGLEAM">>).
+ gleam@expect:equal(
+ gleam@iodata:to_string(
+ gleam@iodata:uppercase(
+ gleam@iodata:from_strings([<<"Gleam">>, <<"Gleam">>])
+ )
+ ),
+ <<"GLEAMGLEAM">>
+ ).
split_test() ->
- gleam@expect:equal(gleam@iodata:split(gleam@iodata:new(<<"Gleam,Erlang,Elixir">>),
- <<",">>),
- [gleam@iodata:new(<<"Gleam">>),
- gleam@iodata:new(<<"Erlang">>),
- gleam@iodata:new(<<"Elixir">>)]),
- gleam@expect:equal(gleam@iodata:split(gleam@iodata:from_strings([<<"Gleam, Erl">>,
- <<"ang,Elixir">>]),
- <<", ">>),
- [gleam@iodata:new(<<"Gleam">>),
- gleam@iodata:from_strings([<<"Erl">>,
- <<"ang,Elixir">>])]).
+ gleam@expect:equal(
+ gleam@iodata:split(gleam@iodata:new(<<"Gleam,Erlang,Elixir">>), <<",">>),
+ [gleam@iodata:new(<<"Gleam">>),
+ gleam@iodata:new(<<"Erlang">>),
+ gleam@iodata:new(<<"Elixir">>)]
+ ),
+ gleam@expect:equal(
+ gleam@iodata:split(
+ gleam@iodata:from_strings([<<"Gleam, Erl">>, <<"ang,Elixir">>]),
+ <<", ">>
+ ),
+ [gleam@iodata:new(<<"Gleam">>),
+ gleam@iodata:from_strings([<<"Erl">>, <<"ang,Elixir">>])]
+ ).
is_equal_test() ->
- gleam@expect:true(gleam@iodata:is_equal(gleam@iodata:new(<<"12">>),
- gleam@iodata:from_strings([<<"1">>,
- <<"2">>]))),
- gleam@expect:true(gleam@iodata:is_equal(gleam@iodata:new(<<"12">>),
- gleam@iodata:new(<<"12">>))),
- gleam@expect:false(gleam@iodata:is_equal(gleam@iodata:new(<<"12">>),
- gleam@iodata:new(<<"2">>))).
+ gleam@expect:true(
+ gleam@iodata:is_equal(
+ gleam@iodata:new(<<"12">>),
+ gleam@iodata:from_strings([<<"1">>, <<"2">>])
+ )
+ ),
+ gleam@expect:true(
+ gleam@iodata:is_equal(
+ gleam@iodata:new(<<"12">>),
+ gleam@iodata:new(<<"12">>)
+ )
+ ),
+ gleam@expect:false(
+ gleam@iodata:is_equal(
+ gleam@iodata:new(<<"12">>),
+ gleam@iodata:new(<<"2">>)
+ )
+ ).
is_empty_test() ->
gleam@expect:true(gleam@iodata:is_empty(gleam@iodata:new(<<"">>))),
gleam@expect:false(gleam@iodata:is_empty(gleam@iodata:new(<<"12">>))),
gleam@expect:true(gleam@iodata:is_empty(gleam@iodata:from_strings([]))),
- gleam@expect:true(gleam@iodata:is_empty(gleam@iodata:from_strings([<<"">>,
- <<"">>]))).
+ gleam@expect:true(
+ gleam@iodata:is_empty(gleam@iodata:from_strings([<<"">>, <<"">>]))
+ ).
diff --git a/gen/test/gleam@list_test.erl b/gen/test/gleam@list_test.erl
index eda42d4..942bee8 100644
--- a/gen/test/gleam@list_test.erl
+++ b/gen/test/gleam@list_test.erl
@@ -33,17 +33,25 @@ tail_test() ->
filter_test() ->
gleam@expect:equal(gleam@list:filter([], fun(_) -> true end), []),
- gleam@expect:equal(gleam@list:filter([0, 4, 5, 7, 3], fun(_) -> true end),
- [0, 4, 5, 7, 3]),
- gleam@expect:equal(gleam@list:filter([0, 4, 5, 7, 3], fun(X) -> X > 4 end),
- [5, 7]),
- gleam@expect:equal(gleam@list:filter([0, 4, 5, 7, 3], fun(X) -> X < 4 end),
- [0, 3]).
+ gleam@expect:equal(
+ gleam@list:filter([0, 4, 5, 7, 3], fun(_) -> true end),
+ [0, 4, 5, 7, 3]
+ ),
+ gleam@expect:equal(
+ gleam@list:filter([0, 4, 5, 7, 3], fun(X) -> X > 4 end),
+ [5, 7]
+ ),
+ gleam@expect:equal(
+ gleam@list:filter([0, 4, 5, 7, 3], fun(X) -> X < 4 end),
+ [0, 3]
+ ).
map_test() ->
gleam@expect:equal(gleam@list:map([], fun(X) -> X * 2 end), []),
- gleam@expect:equal(gleam@list:map([0, 4, 5, 7, 3], fun(X) -> X * 2 end),
- [0, 8, 10, 14, 6]).
+ gleam@expect:equal(
+ gleam@list:map([0, 4, 5, 7, 3], fun(X) -> X * 2 end),
+ [0, 8, 10, 14, 6]
+ ).
traverse_test() ->
Fun = fun(X) -> case X =:= 6 orelse X =:= 5 orelse X =:= 4 of
@@ -53,8 +61,10 @@ traverse_test() ->
false ->
{error, X}
end end,
- gleam@expect:equal(gleam@list:traverse([5, 6, 5, 6], Fun),
- {ok, [10, 12, 10, 12]}),
+ gleam@expect:equal(
+ gleam@list:traverse([5, 6, 5, 6], Fun),
+ {ok, [10, 12, 10, 12]}
+ ),
gleam@expect:equal(gleam@list:traverse([4, 6, 5, 7, 3], Fun), {error, 7}).
drop_test() ->
@@ -63,8 +73,10 @@ drop_test() ->
take_test() ->
gleam@expect:equal(gleam@list:take([], 5), []),
- gleam@expect:equal(gleam@list:take([1, 2, 3, 4, 5, 6, 7, 8], 5),
- [1, 2, 3, 4, 5]).
+ gleam@expect:equal(
+ gleam@list:take([1, 2, 3, 4, 5, 6, 7, 8], 5),
+ [1, 2, 3, 4, 5]
+ ).
new_test() ->
gleam@expect:equal(gleam@list:new(), []).
@@ -79,16 +91,16 @@ flatten_test() ->
gleam@expect:equal(gleam@list:flatten([[1, 2], [], [3, 4]]), [1, 2, 3, 4]).
fold_test() ->
- gleam@expect:equal(gleam@list:fold([1, 2, 3],
- [],
- fun(X, Acc) -> [X | Acc] end),
- [3, 2, 1]).
+ gleam@expect:equal(
+ gleam@list:fold([1, 2, 3], [], fun(X, Acc) -> [X | Acc] end),
+ [3, 2, 1]
+ ).
fold_right_test() ->
- gleam@expect:equal(gleam@list:fold_right([1, 2, 3],
- [],
- fun(X, Acc) -> [X | Acc] end),
- [1, 2, 3]).
+ gleam@expect:equal(
+ gleam@list:fold_right([1, 2, 3], [], fun(X, Acc) -> [X | Acc] end),
+ [1, 2, 3]
+ ).
find_test() ->
F = fun(X) -> case X of
@@ -103,32 +115,44 @@ find_test() ->
gleam@expect:is_error(gleam@list:find([1, 3], F)).
all_test() ->
- gleam@expect:equal(gleam@list:all([1, 2, 3, 4, 5], fun(X) -> X > 0 end),
- true),
- gleam@expect:equal(gleam@list:all([1, 2, 3, 4, 5], fun(X) -> X < 0 end),
- false),
+ gleam@expect:equal(
+ gleam@list:all([1, 2, 3, 4, 5], fun(X) -> X > 0 end),
+ true
+ ),
+ gleam@expect:equal(
+ gleam@list:all([1, 2, 3, 4, 5], fun(X) -> X < 0 end),
+ false
+ ),
gleam@expect:equal(gleam@list:all([], fun(_) -> false end), true).
any_test() ->
- gleam@expect:equal(gleam@list:any([1, 2, 3, 4, 5], fun(X) -> X =:= 2 end),
- true),
- gleam@expect:equal(gleam@list:any([1, 2, 3, 4, 5], fun(X) -> X < 0 end),
- false),
+ gleam@expect:equal(
+ gleam@list:any([1, 2, 3, 4, 5], fun(X) -> X =:= 2 end),
+ true
+ ),
+ gleam@expect:equal(
+ gleam@list:any([1, 2, 3, 4, 5], fun(X) -> X < 0 end),
+ false
+ ),
gleam@expect:equal(gleam@list:any([], fun(_) -> false end), false).
zip_test() ->
gleam@expect:equal(gleam@list:zip([], [1, 2, 3]), []),
gleam@expect:equal(gleam@list:zip([1, 2], []), []),
- gleam@expect:equal(gleam@list:zip([1, 2, 3], [4, 5, 6]),
- [{1, 4}, {2, 5}, {3, 6}]),
+ gleam@expect:equal(
+ gleam@list:zip([1, 2, 3], [4, 5, 6]),
+ [{1, 4}, {2, 5}, {3, 6}]
+ ),
gleam@expect:equal(gleam@list:zip([5, 6], [1, 2, 3]), [{5, 1}, {6, 2}]),
gleam@expect:equal(gleam@list:zip([5, 6, 7], [1, 2]), [{5, 1}, {6, 2}]).
strict_zip_test() ->
gleam@expect:is_error(gleam@list:strict_zip([], [1, 2, 3])),
gleam@expect:is_error(gleam@list:strict_zip([1, 2], [])),
- gleam@expect:equal(gleam@list:strict_zip([1, 2, 3], [4, 5, 6]),
- {ok, [{1, 4}, {2, 5}, {3, 6}]}),
+ gleam@expect:equal(
+ gleam@list:strict_zip([1, 2, 3], [4, 5, 6]),
+ {ok, [{1, 4}, {2, 5}, {3, 6}]}
+ ),
gleam@expect:is_error(gleam@list:strict_zip([5, 6], [1, 2, 3])),
gleam@expect:is_error(gleam@list:strict_zip([5, 6, 7], [1, 2])).
@@ -143,25 +167,35 @@ at_test() ->
gleam@expect:is_error(gleam@list:at([1, 2, 3, 4, 5, 6], -1)).
unique_test() ->
- gleam@expect:equal(gleam@list:unique([1, 1, 2, 3, 4, 4, 4, 5, 6]),
- [1, 2, 3, 4, 5, 6]),
- gleam@expect:equal(gleam@list:unique([7, 1, 45, 6, 2, 47, 2, 7, 5]),
- [7, 1, 45, 6, 2, 47, 5]),
+ gleam@expect:equal(
+ gleam@list:unique([1, 1, 2, 3, 4, 4, 4, 5, 6]),
+ [1, 2, 3, 4, 5, 6]
+ ),
+ gleam@expect:equal(
+ gleam@list:unique([7, 1, 45, 6, 2, 47, 2, 7, 5]),
+ [7, 1, 45, 6, 2, 47, 5]
+ ),
gleam@expect:equal(gleam@list:unique([3, 4, 5]), [3, 4, 5]),
gleam@expect:equal(gleam@list:unique([]), []).
sort_test() ->
gleam@expect:equal(gleam@list:sort([4, 3, 6, 5, 4]), [3, 4, 4, 5, 6]),
gleam@expect:equal(gleam@list:sort([]), []),
- gleam@expect:equal(gleam@list:sort([{1, 2}, {4, 5}, {3, 2}]),
- [{1, 2}, {3, 2}, {4, 5}]).
+ gleam@expect:equal(
+ gleam@list:sort([{1, 2}, {4, 5}, {3, 2}]),
+ [{1, 2}, {3, 2}, {4, 5}]
+ ).
index_map_test() ->
- gleam@expect:equal(gleam@list:index_map([3, 4, 5], fun(I, X) -> {I, X} end),
- [{0, 3}, {1, 4}, {2, 5}]),
+ gleam@expect:equal(
+ gleam@list:index_map([3, 4, 5], fun(I, X) -> {I, X} end),
+ [{0, 3}, {1, 4}, {2, 5}]
+ ),
F = fun(I, X) -> gleam@string:append(X, gleam@int:to_string(I)) end,
- gleam@expect:equal(gleam@list:index_map([<<"a">>, <<"b">>, <<"c">>], F),
- [<<"a0">>, <<"b1">>, <<"c2">>]).
+ gleam@expect:equal(
+ gleam@list:index_map([<<"a">>, <<"b">>, <<"c">>], F),
+ [<<"a0">>, <<"b1">>, <<"c2">>]
+ ).
range_test() ->
gleam@expect:equal(gleam@list:range(0, 0), []),
@@ -175,34 +209,52 @@ repeat_test() ->
gleam@expect:equal(gleam@list:repeat(1, -10), []),
gleam@expect:equal(gleam@list:repeat(1, 0), []),
gleam@expect:equal(gleam@list:repeat(2, 3), [2, 2, 2]),
- gleam@expect:equal(gleam@list:repeat(<<"x">>, 5),
- [<<"x">>, <<"x">>, <<"x">>, <<"x">>, <<"x">>]).
+ gleam@expect:equal(
+ gleam@list:repeat(<<"x">>, 5),
+ [<<"x">>, <<"x">>, <<"x">>, <<"x">>, <<"x">>]
+ ).
split_test() ->
gleam@expect:equal(gleam@list:split([], 0), {[], []}),
- gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 0),
- {[], [0, 1, 2, 3, 4]}),
- gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], -2),
- {[], [0, 1, 2, 3, 4]}),
- gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 1),
- {[0], [1, 2, 3, 4]}),
- gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 3),
- {[0, 1, 2], [3, 4]}),
- gleam@expect:equal(gleam@list:split([0, 1, 2, 3, 4], 9),
- {[0, 1, 2, 3, 4], []}).
+ gleam@expect:equal(
+ gleam@list:split([0, 1, 2, 3, 4], 0),
+ {[], [0, 1, 2, 3, 4]}
+ ),
+ gleam@expect:equal(
+ gleam@list:split([0, 1, 2, 3, 4], -2),
+ {[], [0, 1, 2, 3, 4]}
+ ),
+ gleam@expect:equal(
+ gleam@list:split([0, 1, 2, 3, 4], 1),
+ {[0], [1, 2, 3, 4]}
+ ),
+ gleam@expect:equal(
+ gleam@list:split([0, 1, 2, 3, 4], 3),
+ {[0, 1, 2], [3, 4]}
+ ),
+ gleam@expect:equal(
+ gleam@list:split([0, 1, 2, 3, 4], 9),
+ {[0, 1, 2, 3, 4], []}
+ ).
split_while_test() ->
- gleam@expect:equal(gleam@list:split_while([], fun(X) -> X =< 5 end),
- {[], []}),
- gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
- fun(X) -> X =< 5 end),
- {[1, 2, 3, 4, 5], []}),
- gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
- fun(X) -> X =:= 2 end),
- {[], [1, 2, 3, 4, 5]}),
- gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
- fun(X) -> X =< 3 end),
- {[1, 2, 3], [4, 5]}),
- gleam@expect:equal(gleam@list:split_while([1, 2, 3, 4, 5],
- fun(X) -> X =< -3 end),
- {[], [1, 2, 3, 4, 5]}).
+ gleam@expect:equal(
+ gleam@list:split_while([], fun(X) -> X =< 5 end),
+ {[], []}
+ ),
+ gleam@expect:equal(
+ gleam@list:split_while([1, 2, 3, 4, 5], fun(X) -> X =< 5 end),
+ {[1, 2, 3, 4, 5], []}
+ ),
+ gleam@expect:equal(
+ gleam@list:split_while([1, 2, 3, 4, 5], fun(X) -> X =:= 2 end),
+ {[], [1, 2, 3, 4, 5]}
+ ),
+ gleam@expect:equal(
+ gleam@list:split_while([1, 2, 3, 4, 5], fun(X) -> X =< 3 end),
+ {[1, 2, 3], [4, 5]}
+ ),
+ gleam@expect:equal(
+ gleam@list:split_while([1, 2, 3, 4, 5], fun(X) -> X =< -3 end),
+ {[], [1, 2, 3, 4, 5]}
+ ).
diff --git a/gen/test/gleam@map_dict_test.erl b/gen/test/gleam@map_dict_test.erl
index f19f735..98c1486 100644
--- a/gen/test/gleam@map_dict_test.erl
+++ b/gen/test/gleam@map_dict_test.erl
@@ -4,20 +4,22 @@
-export([from_list_test/0, has_key_test/0, new_test/0, fetch_test/0, put_test/0, map_values_test/0, keys_test/0, values_test/0, take_test/0, drop_test/0, merge_test/0, delete_test/0, update_test/0, fold_test/0]).
from_list_test() ->
- gleam@expect:equal(gleam@map_dict:size(gleam@map_dict:from_list([{4, 0},
- {1, 0}])),
- 2).
+ gleam@expect:equal(
+ gleam@map_dict:size(gleam@map_dict:from_list([{4, 0}, {1, 0}])),
+ 2
+ ).
has_key_test() ->
gleam@expect:false(gleam@map_dict:has_key(gleam@map_dict:from_list([]), 1)),
- gleam@expect:true(gleam@map_dict:has_key(gleam@map_dict:from_list([{1, 0}]),
- 1)),
- gleam@expect:true(gleam@map_dict:has_key(gleam@map_dict:from_list([{4, 0},
- {1, 0}]),
- 1)),
- gleam@expect:false(gleam@map_dict:has_key(gleam@map_dict:from_list([{4, 0},
- {1, 0}]),
- 0)).
+ gleam@expect:true(
+ gleam@map_dict:has_key(gleam@map_dict:from_list([{1, 0}]), 1)
+ ),
+ gleam@expect:true(
+ gleam@map_dict:has_key(gleam@map_dict:from_list([{4, 0}, {1, 0}]), 1)
+ ),
+ gleam@expect:false(
+ gleam@map_dict:has_key(gleam@map_dict:from_list([{4, 0}, {1, 0}]), 0)
+ ).
new_test() ->
gleam@expect:equal(gleam@map_dict:size(gleam@map_dict:new()), 0),
@@ -31,89 +33,91 @@ fetch_test() ->
gleam@expect:is_error(gleam@map_dict:fetch(M, 2)).
put_test() ->
- gleam@expect:equal(gleam@map_dict:put(gleam@map_dict:put(gleam@map_dict:put(gleam@map_dict:new(),
- <<"a">>,
- 0),
- <<"b">>,
- 1),
- <<"c">>,
- 2),
- gleam@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2}])).
+ gleam@expect:equal(
+ gleam@map_dict:put(
+ gleam@map_dict:put(
+ gleam@map_dict:put(gleam@map_dict:new(), <<"a">>, 0),
+ <<"b">>,
+ 1
+ ),
+ <<"c">>,
+ 2
+ ),
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}])
+ ).
map_values_test() ->
- gleam@expect:equal(gleam@map_dict:map_values(gleam@map_dict:from_list([{1,
- 0},
- {2,
- 1},
- {3,
- 2}]),
- fun(K, V) -> K + V end),
- gleam@map_dict:from_list([{1, 1}, {2, 3}, {3, 5}])).
+ gleam@expect:equal(
+ gleam@map_dict:map_values(
+ gleam@map_dict:from_list([{1, 0}, {2, 1}, {3, 2}]),
+ fun(K, V) -> K + V end
+ ),
+ gleam@map_dict:from_list([{1, 1}, {2, 3}, {3, 5}])
+ ).
keys_test() ->
- gleam@expect:equal(gleam@map_dict:keys(gleam@map_dict:from_list([{<<"a">>,
- 0},
- {<<"b">>,
- 1},
- {<<"c">>,
- 2}])),
- [<<"a">>, <<"b">>, <<"c">>]).
+ gleam@expect:equal(
+ gleam@map_dict:keys(
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}])
+ ),
+ [<<"a">>, <<"b">>, <<"c">>]
+ ).
values_test() ->
- gleam@expect:equal(gleam@map_dict:values(gleam@map_dict:from_list([{<<"a">>,
- 0},
- {<<"b">>,
- 1},
- {<<"c">>,
- 2}])),
- [0, 1, 2]).
+ gleam@expect:equal(
+ gleam@map_dict:values(
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}])
+ ),
+ [0, 1, 2]
+ ).
take_test() ->
- gleam@expect:equal(gleam@map_dict:take(gleam@map_dict:from_list([{<<"a">>,
- 0},
- {<<"b">>,
- 1},
- {<<"c">>,
- 2}]),
- [<<"a">>, <<"b">>, <<"d">>]),
- gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}])).
+ gleam@expect:equal(
+ gleam@map_dict:take(
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
+ [<<"a">>, <<"b">>, <<"d">>]
+ ),
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}])
+ ).
drop_test() ->
- gleam@expect:equal(gleam@map_dict:drop(gleam@map_dict:from_list([{<<"a">>,
- 0},
- {<<"b">>,
- 1},
- {<<"c">>,
- 2}]),
- [<<"a">>, <<"b">>, <<"d">>]),
- gleam@map_dict:from_list([{<<"c">>, 2}])).
+ gleam@expect:equal(
+ gleam@map_dict:drop(
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
+ [<<"a">>, <<"b">>, <<"d">>]
+ ),
+ gleam@map_dict:from_list([{<<"c">>, 2}])
+ ).
merge_test() ->
A = gleam@map_dict:from_list([{<<"a">>, 2}, {<<"c">>, 4}, {<<"d">>, 3}]),
B = gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
- gleam@expect:equal(gleam@map_dict:merge(A, B),
- gleam@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2},
- {<<"d">>, 3}])),
- gleam@expect:equal(gleam@map_dict:merge(B, A),
- gleam@map_dict:from_list([{<<"a">>, 2},
- {<<"b">>, 1},
- {<<"c">>, 4},
- {<<"d">>, 3}])).
+ gleam@expect:equal(
+ gleam@map_dict:merge(A, B),
+ gleam@map_dict:from_list(
+ [{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}, {<<"d">>, 3}]
+ )
+ ),
+ gleam@expect:equal(
+ gleam@map_dict:merge(B, A),
+ gleam@map_dict:from_list(
+ [{<<"a">>, 2}, {<<"b">>, 1}, {<<"c">>, 4}, {<<"d">>, 3}]
+ )
+ ).
delete_test() ->
- gleam@expect:equal(gleam@map_dict:delete(gleam@map_dict:delete(gleam@map_dict:from_list([{<<"a">>,
- 0},
- {<<"b">>,
- 1},
- {<<"c">>,
- 2}]),
- <<"a">>),
- <<"d">>),
- gleam@map_dict:from_list([{<<"b">>, 1}, {<<"c">>, 2}])).
+ gleam@expect:equal(
+ gleam@map_dict:delete(
+ gleam@map_dict:delete(
+ gleam@map_dict:from_list(
+ [{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]
+ ),
+ <<"a">>
+ ),
+ <<"d">>
+ ),
+ gleam@map_dict:from_list([{<<"b">>, 1}, {<<"c">>, 2}])
+ ).
update_test() ->
Dict = gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}]),
@@ -124,28 +128,30 @@ update_test() ->
{error, _} ->
0
end end,
- gleam@expect:equal(gleam@map_dict:update(Dict, <<"a">>, IncOrZero),
- gleam@map_dict:from_list([{<<"a">>, 1},
- {<<"b">>, 1},
- {<<"c">>, 2}])),
- gleam@expect:equal(gleam@map_dict:update(Dict, <<"b">>, IncOrZero),
- gleam@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 2},
- {<<"c">>, 2}])),
- gleam@expect:equal(gleam@map_dict:update(Dict, <<"z">>, IncOrZero),
- gleam@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2},
- {<<"z">>, 0}])).
+ gleam@expect:equal(
+ gleam@map_dict:update(Dict, <<"a">>, IncOrZero),
+ gleam@map_dict:from_list([{<<"a">>, 1}, {<<"b">>, 1}, {<<"c">>, 2}])
+ ),
+ gleam@expect:equal(
+ gleam@map_dict:update(Dict, <<"b">>, IncOrZero),
+ gleam@map_dict:from_list([{<<"a">>, 0}, {<<"b">>, 2}, {<<"c">>, 2}])
+ ),
+ gleam@expect:equal(
+ gleam@map_dict:update(Dict, <<"z">>, IncOrZero),
+ gleam@map_dict:from_list(
+ [{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}, {<<"z">>, 0}]
+ )
+ ).
fold_test() ->
- Dict = gleam@map_dict:from_list([{<<"a">>, 0},
- {<<"b">>, 1},
- {<<"c">>, 2},
- {<<"d">>, 3}]),
+ Dict = gleam@map_dict:from_list(
+ [{<<"a">>, 0}, {<<"b">>, 1}, {<<"c">>, 2}, {<<"d">>, 3}]
+ ),
Add = fun(_, V, Acc) -> V + Acc end,
gleam@expect:equal(gleam@map_dict:fold(Dict, 0, Add), 6),
Concat = fun(K, _, Acc) -> gleam@string:append(Acc, K) end,
gleam@expect:equal(gleam@map_dict:fold(Dict, <<"">>, Concat), <<"abcd">>),
- gleam@expect:equal(gleam@map_dict:fold(gleam@map_dict:from_list([]), 0, Add),
- 0).
+ gleam@expect:equal(
+ gleam@map_dict:fold(gleam@map_dict:from_list([]), 0, Add),
+ 0
+ ).
diff --git a/gen/test/gleam@result_test.erl b/gen/test/gleam@result_test.erl
index baf030f..ee32547 100644
--- a/gen/test/gleam@result_test.erl
+++ b/gen/test/gleam@result_test.erl
@@ -13,35 +13,51 @@ is_error_test() ->
map_test() ->
gleam@expect:equal(gleam@result:map({ok, 1}, fun(X) -> X + 1 end), {ok, 2}),
- gleam@expect:equal(gleam@result:map({ok, 1}, fun(_) -> <<"2">> end),
- {ok, <<"2">>}),
- gleam@expect:equal(gleam@result:map({error, 1}, fun(X) -> X + 1 end),
- {error, 1}).
+ gleam@expect:equal(
+ gleam@result:map({ok, 1}, fun(_) -> <<"2">> end),
+ {ok, <<"2">>}
+ ),
+ gleam@expect:equal(
+ gleam@result:map({error, 1}, fun(X) -> X + 1 end),
+ {error, 1}
+ ).
map_error_test() ->
- gleam@expect:equal(gleam@result:map_error({ok, 1}, fun(X) -> X + 1 end),
- {ok, 1}),
- gleam@expect:equal(gleam@result:map_error({error, 1},
- fun(X) -> {<<"ok">>, X + 1} end),
- {error, {<<"ok">>, 2}}).
+ gleam@expect:equal(
+ gleam@result:map_error({ok, 1}, fun(X) -> X + 1 end),
+ {ok, 1}
+ ),
+ gleam@expect:equal(
+ gleam@result:map_error({error, 1}, fun(X) -> {<<"ok">>, X + 1} end),
+ {error, {<<"ok">>, 2}}
+ ).
flatten_test() ->
gleam@expect:equal(gleam@result:flatten({ok, {ok, 1}}), {ok, 1}),
gleam@expect:equal(gleam@result:flatten({ok, {error, 1}}), {error, 1}),
gleam@expect:equal(gleam@result:flatten({error, 1}), {error, 1}),
- gleam@expect:equal(gleam@result:flatten({error, {error, 1}}),
- {error, {error, 1}}).
+ gleam@expect:equal(
+ gleam@result:flatten({error, {error, 1}}),
+ {error, {error, 1}}
+ ).
then_test() ->
- gleam@expect:equal(gleam@result:then({error, 1}, fun(X) -> {ok, X + 1} end),
- {error, 1}),
- gleam@expect:equal(gleam@result:then({ok, 1}, fun(X) -> {ok, X + 1} end),
- {ok, 2}),
- gleam@expect:equal(gleam@result:then({ok, 1},
- fun(_) -> {ok, <<"type change">>} end),
- {ok, <<"type change">>}),
- gleam@expect:equal(gleam@result:then({ok, 1}, fun(_) -> {error, 1} end),
- {error, 1}).
+ gleam@expect:equal(
+ gleam@result:then({error, 1}, fun(X) -> {ok, X + 1} end),
+ {error, 1}
+ ),
+ gleam@expect:equal(
+ gleam@result:then({ok, 1}, fun(X) -> {ok, X + 1} end),
+ {ok, 2}
+ ),
+ gleam@expect:equal(
+ gleam@result:then({ok, 1}, fun(_) -> {ok, <<"type change">>} end),
+ {ok, <<"type change">>}
+ ),
+ gleam@expect:equal(
+ gleam@result:then({ok, 1}, fun(_) -> {error, 1} end),
+ {error, 1}
+ ).
unwrap_test() ->
gleam@expect:equal(gleam@result:unwrap({ok, 1}, 50), 1),
diff --git a/gen/test/gleam@string_test.erl b/gen/test/gleam@string_test.erl
index 5d1d912..767d11c 100644
--- a/gen/test/gleam@string_test.erl
+++ b/gen/test/gleam@string_test.erl
@@ -18,17 +18,23 @@ reverse_test() ->
gleam@expect:equal(gleam@string:reverse(<<"Gleam">>), <<"maelG">>).
split_test() ->
- gleam@expect:equal(gleam@string:split(<<"Gleam,Erlang,Elixir">>, <<",">>),
- [<<"Gleam">>, <<"Erlang">>, <<"Elixir">>]),
- gleam@expect:equal(gleam@string:split(<<"Gleam, Erlang,Elixir">>, <<", ">>),
- [<<"Gleam">>, <<"Erlang,Elixir">>]).
+ gleam@expect:equal(
+ gleam@string:split(<<"Gleam,Erlang,Elixir">>, <<",">>),
+ [<<"Gleam">>, <<"Erlang">>, <<"Elixir">>]
+ ),
+ gleam@expect:equal(
+ gleam@string:split(<<"Gleam, Erlang,Elixir">>, <<", ">>),
+ [<<"Gleam">>, <<"Erlang,Elixir">>]
+ ).
replace_test() ->
- gleam@expect:equal(gleam@string:replace(<<"Gleam,Erlang,Elixir">>,
- <<",">>,
- <<"++">>),
- <<"Gleam++Erlang++Elixir">>).
+ gleam@expect:equal(
+ gleam@string:replace(<<"Gleam,Erlang,Elixir">>, <<",">>, <<"++">>),
+ <<"Gleam++Erlang++Elixir">>
+ ).
append_test() ->
- gleam@expect:equal(gleam@string:append(<<"Test">>, <<" Me">>),
- <<"Test Me">>).
+ gleam@expect:equal(
+ gleam@string:append(<<"Test">>, <<" Me">>),
+ <<"Test Me">>
+ ).