From 2109886ed8a7fc9aae1a2f5f9fb4e85cc29f49e5 Mon Sep 17 00:00:00 2001 From: Erik Terpstra <39518+eterps@users.noreply.github.com> Date: Mon, 18 May 2020 09:21:06 +0200 Subject: string.drop_left & string.drop_right --- test/gleam/string_test.gleam | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test') diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam index 05c939c..0695749 100644 --- a/test/gleam/string_test.gleam +++ b/test/gleam/string_test.gleam @@ -184,6 +184,38 @@ pub fn slice_test() { "gleam" |> string.slice(at_index: -12, length: 2) |> should.equal("") + + "gleam" + |> string.slice(at_index: 2, length: -3) + |> should.equal("") +} + +pub fn drop_left_test() { + "gleam" + |> string.drop_left(up_to: 2) + |> should.equal("eam") + + "gleam" + |> string.drop_left(up_to: 6) + |> should.equal("") + + "gleam" + |> string.drop_left(up_to: -2) + |> should.equal("gleam") +} + +pub fn drop_right_test() { + "gleam" + |> string.drop_right(up_to: 2) + |> should.equal("gle") + + "gleam" + |> string.drop_right(up_to: 5) + |> should.equal("") + + "gleam" + |> string.drop_right(up_to: -2) + |> should.equal("gleam") } pub fn pad_left_test() { -- cgit v1.2.3