From a13164e370b17699797f616b9c8fd54a135ad490 Mon Sep 17 00:00:00 2001 From: Ahmad Sattar Date: Wed, 17 Jun 2020 22:21:07 +0200 Subject: Option flatten function --- test/gleam/option_test.gleam | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/gleam/option_test.gleam b/test/gleam/option_test.gleam index edbb569..03f4186 100644 --- a/test/gleam/option_test.gleam +++ b/test/gleam/option_test.gleam @@ -54,3 +54,17 @@ pub fn map_option_test() { |> option.map(fn(x) { x + 1 }) |> should.equal(None) } + +pub fn flatten_option_test() { + Some(Some(1)) + |> option.flatten() + |> should.equal(Some(1)) + + Some(None) + |> option.flatten() + |> should.equal(None) + + None + |> option.flatten() + |> should.equal(None) +} -- cgit v1.2.3