diff options
Diffstat (limited to 'src/iodata.gleam')
-rw-r--r-- | src/iodata.gleam | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/iodata.gleam b/src/iodata.gleam index 81329d0..56efc65 100644 --- a/src/iodata.gleam +++ b/src/iodata.gleam @@ -1,8 +1,3 @@ -import expect - -// concat should work on List(Iodata) -// need a name for the string version - pub external type Iodata; pub external fn prepend(Iodata, String) -> Iodata = @@ -35,54 +30,10 @@ pub external fn byte_size(Iodata) -> Int = pub external fn from_float(Float) -> Iodata = "io_lib_format" "fwrite_g"; -test iodata { - let iodata = new("ello") - |> append(_, ",") - |> append(_, " world!") - |> prepend(_, "H") - - iodata - |> to_string - |> expect:equal(_, "Hello, world!") - - iodata - |> byte_size - |> expect:equal(_, 13) - - let iodata = new("ello") - |> append_iodata(_, new(",")) - |> append_iodata(_, concat([new(" wo"), new("rld!")])) - |> prepend_iodata(_, new("H")) - - iodata - |> to_string - |> expect:equal(_, "Hello, world!") - - iodata - |> byte_size - |> expect:equal(_, 13) -} - pub external fn lowercase(Iodata) -> Iodata = "string" "lowercase" -test lowercase { - ["Gleam", "Gleam"] - |> from_strings - |> lowercase - |> to_string - |> expect:equal(_, "gleamgleam") -} - pub external fn uppercase(Iodata) -> Iodata = "string" "uppercase" -test uppercase { - ["Gleam", "Gleam"] - |> from_strings - |> uppercase - |> to_string - |> expect:equal(_, "GLEAMGLEAM") -} - pub external fn reverse(Iodata) -> Iodata = "string" "reverse" enum Direction = @@ -95,18 +46,6 @@ pub fn split(iodata, on) { erl_split(iodata, on, All) } -test split { - "Gleam,Erlang,Elixir" - |> new - |> split(_, ",") - |> expect:equal(_, [new("Gleam"), new("Erlang"), new("Elixir")]) - - ["Gleam, Erl", "ang,Elixir"] - |> from_strings - |> split(_, ", ") - |> expect:equal(_, [new("Gleam"), from_strings(["Erl", "ang,Elixir"])]) -} - external fn erl_replace(Iodata, String, String, Direction) -> Iodata = "string" "replace" @@ -116,36 +55,4 @@ pub fn replace(iodata, pattern, replacement) { pub external fn is_equal(Iodata, Iodata) -> Bool = "string" "equal" -test is_equal { - new("12") - |> is_equal(_, from_strings(["1", "2"])) - |> expect:true - - new("12") - |> is_equal(_, new("12")) - |> expect:true - - new("12") - |> is_equal(_, new("2")) - |> expect:false -} - pub external fn is_empty(Iodata) -> Bool = "string" "is_empty" - -test is_empty { - new("") - |> is_empty - |> expect:true - - new("12") - |> is_empty - |> expect:false - - from_strings([]) - |> is_empty - |> expect:true - - from_strings(["", ""]) - |> is_empty - |> expect:true -} |