From 3a9181fc74ae1f71e109d074b0cebaba399184d0 Mon Sep 17 00:00:00 2001 From: evuez Date: Sat, 20 Feb 2021 17:40:01 +0100 Subject: Implement list.drop_while and list.take_while --- test/gleam/list_test.gleam | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam index 3277e47..f1acfb2 100644 --- a/test/gleam/list_test.gleam +++ b/test/gleam/list_test.gleam @@ -578,3 +578,15 @@ pub fn window_by_2_test() { |> list.window_by_2 |> should.equal([]) } + +pub fn drop_while_test() { + [1, 2, 3, 4] + |> list.drop_while(fn(x) { x < 3 }) + |> should.equal([3, 4]) +} + +pub fn take_while_test() { + [1, 2, 3, 4] + |> list.take_while(fn(x) { x < 3 }) + |> should.equal([1, 2]) +} -- cgit v1.2.3