From 5ca885bd114635244d25f2f91c35bda448e6a635 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Tue, 19 May 2020 18:55:06 +0100 Subject: list.filter_map --- test/gleam/list_test.gleam | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam index 1be4e43..4576d7f 100644 --- a/test/gleam/list_test.gleam +++ b/test/gleam/list_test.gleam @@ -79,6 +79,16 @@ pub fn filter_test() { |> should.equal([0, 3]) } +pub fn filter_map_test() { + [2, 4, 6, 1] + |> list.filter_map(fn(x) { Ok(x + 1) }) + |> should.equal([3, 5, 7, 2]) + + [2, 4, 6, 1] + |> list.filter_map(Error) + |> should.equal([]) +} + pub fn map_test() { [] |> list.map(fn(x) { x * 2 }) -- cgit v1.2.3