aboutsummaryrefslogtreecommitdiff
path: root/gen/iodata.erl
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-03-12 18:53:16 +0000
committerLouis Pilfold <louis@lpil.uk>2019-03-12 18:53:16 +0000
commit447cd2ba25ac0414ed7604a49484a7590f40d202 (patch)
tree082e73d0bca06f843cf018de76b0fab329d2ab20 /gen/iodata.erl
parent80a8083b143eaa24218ec5fda16f947658fb823d (diff)
downloadgleam_stdlib-447cd2ba25ac0414ed7604a49484a7590f40d202.tar.gz
gleam_stdlib-447cd2ba25ac0414ed7604a49484a7590f40d202.zip
list:flatten, list:append, test iodata
Diffstat (limited to 'gen/iodata.erl')
-rw-r--r--gen/iodata.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/gen/iodata.erl b/gen/iodata.erl
index 9704413..a17f87a 100644
--- a/gen/iodata.erl
+++ b/gen/iodata.erl
@@ -1,10 +1,11 @@
-module(iodata).
-compile(no_auto_import).
+-include_lib("eunit/include/eunit.hrl").
-export([prepend/2, append/2, from/1, to_string/1, byte_size/1]).
prepend(A, B) ->
- gleam__stdlib:iodata_concat(A, B).
+ gleam__stdlib:iodata_prepend(A, B).
append(A, B) ->
gleam__stdlib:iodata_append(A, B).
@@ -17,3 +18,16 @@ to_string(A) ->
byte_size(A) ->
erlang:iolist_size(A).
+
+-ifdef(TEST).
+iodata_test() ->
+ Iodata = (fun(Capture1) ->
+ prepend(Capture1, <<"H">>)
+ end)((fun(Capture1) ->
+ append(Capture1, <<" world!">>)
+ end)((fun(Capture1) ->
+ append(Capture1, <<",">>)
+ end)(from([<<"ello">>])))),
+ expect:equal(to_string(Iodata), <<"Hello, world!">>),
+ expect:equal(byte_size(Iodata), 13).
+-endif.