aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAhmad Sattar <thehabbos007@gmail.com>2020-06-17 22:12:52 +0200
committerLouis Pilfold <louis@lpil.uk>2020-06-18 21:54:19 +0100
commit75a5d752341cef2e35ec82752ab9b34539dba2a4 (patch)
tree719948a124c5d3cd026ff7e71730c0db78a34b7c /test
parent8b7f2290c67d7fc8714425785aaa14bcd781623c (diff)
downloadgleam_stdlib-75a5d752341cef2e35ec82752ab9b34539dba2a4.tar.gz
gleam_stdlib-75a5d752341cef2e35ec82752ab9b34539dba2a4.zip
Option map 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 e41c221..edbb569 100644
--- a/test/gleam/option_test.gleam
+++ b/test/gleam/option_test.gleam
@@ -40,3 +40,17 @@ pub fn unwrap_option_test() {
option.unwrap(None, 0)
|> should.equal(0)
}
+
+pub fn map_option_test() {
+ Some(1)
+ |> option.map(fn(x) { x + 1 })
+ |> should.equal(Some(2))
+
+ Some(1)
+ |> option.map(fn(x) { "2" })
+ |> should.equal(Some("2"))
+
+ None
+ |> option.map(fn(x) { x + 1 })
+ |> should.equal(None)
+}