aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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)
+}