diff options
author | greggreg <greg@greggreg.org> | 2020-04-16 08:50:24 -0600 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-04-16 16:23:19 +0100 |
commit | bfdde0ee0b60482f5d41e7e6cbae2b11f9daf08f (patch) | |
tree | 15df4af63010fb0010b821dcf6f4b5000b4f7479 /test | |
parent | 95ad77fdd2a5f2282eee5248921973863f998427 (diff) | |
download | gleam_stdlib-bfdde0ee0b60482f5d41e7e6cbae2b11f9daf08f.tar.gz gleam_stdlib-bfdde0ee0b60482f5d41e7e6cbae2b11f9daf08f.zip |
Implementing String.contains and String.repeat
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!", |