aboutsummaryrefslogtreecommitdiff
path: root/src/iodata.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/iodata.gleam')
-rw-r--r--src/iodata.gleam15
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)
+}