diff options
Diffstat (limited to 'gen/iodata.erl')
-rw-r--r-- | gen/iodata.erl | 16 |
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. |