diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/string_test.gleam | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam index ae8a0e9..133bdf5 100644 --- a/test/gleam/string_test.gleam +++ b/test/gleam/string_test.gleam @@ -67,6 +67,19 @@ pub fn compare_test() { |> should.equal(_, order.Gt) } +pub fn contains_test() { + "gleam" + |> string.contains(_, "ea") + |> should.equal(_, True) + + "gleam" + |> string.contains(_, "x") + |> should.equal(_, False) + + string.contains(does: "bellwether", contain: "bell") + |> should.equal(_, True) +} + pub fn concat_test() { [ "Hello", ", ", "world!", @@ -75,6 +88,20 @@ pub fn concat_test() { |> should.equal(_, "Hello, world!") } +pub fn repeat_test() { + "hi" + |> string.repeat(_, times: 3) + |> should.equal(_, "hihihi") + + "hi" + |> string.repeat(_, 0) + |> should.equal(_, "") + + "hi" + |> string.repeat(_, -1) + |> should.equal(_, "") +} + pub fn join_test() { [ "Hello", "world!", |