aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2020-05-19 18:55:06 +0100
committerLouis Pilfold <louis@lpil.uk>2020-05-19 19:22:49 +0100
commit5ca885bd114635244d25f2f91c35bda448e6a635 (patch)
tree3139a84b322575e8044e392d2df6d88ba95840f3 /test
parentcbf07061be7524aa049864b6dec49715e641499a (diff)
downloadgleam_stdlib-5ca885bd114635244d25f2f91c35bda448e6a635.tar.gz
gleam_stdlib-5ca885bd114635244d25f2f91c35bda448e6a635.zip
list.filter_map
Diffstat (limited to 'test')
-rw-r--r--test/gleam/list_test.gleam10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index 1be4e43..4576d7f 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -79,6 +79,16 @@ pub fn filter_test() {
|> should.equal([0, 3])
}
+pub fn filter_map_test() {
+ [2, 4, 6, 1]
+ |> list.filter_map(fn(x) { Ok(x + 1) })
+ |> should.equal([3, 5, 7, 2])
+
+ [2, 4, 6, 1]
+ |> list.filter_map(Error)
+ |> should.equal([])
+}
+
pub fn map_test() {
[]
|> list.map(fn(x) { x * 2 })