aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/string_test.gleam14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam
index 2fbb84f..a9b0d79 100644
--- a/test/gleam/string_test.gleam
+++ b/test/gleam/string_test.gleam
@@ -38,6 +38,20 @@ pub fn split_test() {
|> should.equal(["Gleam", "Erlang,Elixir"])
}
+pub fn split_first_test() {
+ "Gleam,Erlang,Elixir"
+ |> string.split_once(",")
+ |> should.equal(Ok(tuple("Gleam", "Erlang,Elixir")))
+
+ "Gleam"
+ |> string.split_once(",")
+ |> should.equal(Error(Nil))
+
+ ""
+ |> string.split_once(",")
+ |> should.equal(Error(Nil))
+}
+
pub fn replace_test() {
"Gleam,Erlang,Elixir"
|> string.replace(",", "++")