From 157b535280ba3d579d4ec3aafb0ec45db7272ca3 Mon Sep 17 00:00:00 2001 From: Erik Terpstra <39518+eterps@users.noreply.github.com> Date: Fri, 15 May 2020 10:21:25 +0200 Subject: string.starts_with & string.ends_with --- test/gleam/string_test.gleam | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test') diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam index 01e95eb..03678ea 100644 --- a/test/gleam/string_test.gleam +++ b/test/gleam/string_test.gleam @@ -127,3 +127,39 @@ pub fn trim_right_test() { |> string.trim_right() |> should.equal(" hats") } + +pub fn starts_with_test(){ + "theory" + |> string.starts_with("") + |> should.equal(True) + + "theory" + |> string.starts_with("the") + |> should.equal(True) + + "theory" + |> string.starts_with("ory") + |> should.equal(False) + + "theory" + |> string.starts_with("theory2") + |> should.equal(False) +} + +pub fn ends_with_test() { + "theory" + |> string.ends_with("") + |> should.equal(True) + + "theory" + |> string.ends_with("ory") + |> should.equal(True) + + "theory" + |> string.ends_with("the") + |> should.equal(False) + + "theory" + |> string.ends_with("theory2") + |> should.equal(False) +} -- cgit v1.2.3