diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/option_test.gleam | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/gleam/option_test.gleam b/test/gleam/option_test.gleam index 03f4186..7271769 100644 --- a/test/gleam/option_test.gleam +++ b/test/gleam/option_test.gleam @@ -68,3 +68,17 @@ pub fn flatten_option_test() { |> option.flatten() |> should.equal(None) } + +pub fn then_option_test() { + Some(1) + |> option.then(fn(x) { Some(x + 1) }) + |> should.equal(Some(2)) + + Some(1) + |> option.then(fn(x) { Some("2") }) + |> should.equal(Some("2")) + + None + |> option.then(fn(x) { Some(x + 1) }) + |> should.equal(None) +} |