aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAhmad Sattar <thehabbos007@gmail.com>2020-06-17 22:35:27 +0200
committerLouis Pilfold <louis@lpil.uk>2020-06-18 21:54:48 +0100
commit56228f9a5ecfef7fb968d08894a7cc4ce0dfdbae (patch)
tree05800084aed8672ef0f689af1e2e330d59c856e1 /test
parenta13164e370b17699797f616b9c8fd54a135ad490 (diff)
downloadgleam_stdlib-56228f9a5ecfef7fb968d08894a7cc4ce0dfdbae.tar.gz
gleam_stdlib-56228f9a5ecfef7fb968d08894a7cc4ce0dfdbae.zip
Option then function
Diffstat (limited to 'test')
-rw-r--r--test/gleam/option_test.gleam14
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)
+}