diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-03-12 18:53:16 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-03-12 18:53:16 +0000 |
commit | 447cd2ba25ac0414ed7604a49484a7590f40d202 (patch) | |
tree | 082e73d0bca06f843cf018de76b0fab329d2ab20 /src/iodata.gleam | |
parent | 80a8083b143eaa24218ec5fda16f947658fb823d (diff) | |
download | gleam_stdlib-447cd2ba25ac0414ed7604a49484a7590f40d202.tar.gz gleam_stdlib-447cd2ba25ac0414ed7604a49484a7590f40d202.zip |
list:flatten, list:append, test iodata
Diffstat (limited to 'src/iodata.gleam')
-rw-r--r-- | src/iodata.gleam | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/iodata.gleam b/src/iodata.gleam index 1b28577..4d81e38 100644 --- a/src/iodata.gleam +++ b/src/iodata.gleam @@ -1,11 +1,10 @@ import any - -// TODO: Tests +import expect pub external type Iodata; pub external fn prepend(Iodata, String) -> Iodata = - "gleam__stdlib" "iodata_concat"; + "gleam__stdlib" "iodata_prepend"; pub external fn append(Iodata, String) -> Iodata = "gleam__stdlib" "iodata_append"; @@ -18,3 +17,13 @@ pub external fn to_string(Iodata) -> String = pub external fn byte_size(Iodata) -> Int = "erlang" "iolist_size"; + +test iodata { + let iodata = from(["ello"]) + |> append(_, ",") + |> append(_, " world!") + |> prepend(_, "H") + + expect:equal(to_string(iodata), "Hello, world!") + expect:equal(byte_size(iodata), 13) +} |