aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorErik Terpstra <39518+eterps@users.noreply.github.com>2020-05-15 10:21:25 +0200
committerLouis Pilfold <louis@lpil.uk>2020-05-17 13:26:48 +0100
commit157b535280ba3d579d4ec3aafb0ec45db7272ca3 (patch)
tree556ec949bf6078d39100cdf00d42c5fcf48c89f0 /test
parente6b3c90c83a0eb78fe896377c524d496cfd2cb8e (diff)
downloadgleam_stdlib-157b535280ba3d579d4ec3aafb0ec45db7272ca3.tar.gz
gleam_stdlib-157b535280ba3d579d4ec3aafb0ec45db7272ca3.zip
string.starts_with & string.ends_with
Diffstat (limited to 'test')
-rw-r--r--test/gleam/string_test.gleam36
1 files changed, 36 insertions, 0 deletions
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)
+}