aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-12-11 08:42:20 +0000
committerLouis Pilfold <louis@lpil.uk>2020-05-26 19:19:29 +0100
commit59b0492625fa19e7feaa408efa63844765ec56c9 (patch)
treec24378585d32072e0d578c45633f83cbba29c02d
parent85fdfb298d7c9328c41a90e0da02a211785c0aa6 (diff)
downloadgleam_stdlib-59b0492625fa19e7feaa408efa63844765ec56c9.tar.gz
gleam_stdlib-59b0492625fa19e7feaa408efa63844765ec56c9.zip
map test
-rw-r--r--test/gleam/iterator_test.gleam17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/gleam/iterator_test.gleam b/test/gleam/iterator_test.gleam
index 46ac65a..4d43053 100644
--- a/test/gleam/iterator_test.gleam
+++ b/test/gleam/iterator_test.gleam
@@ -55,3 +55,20 @@ pub fn fold_test() {
test([1, 2, 3], [], f)
test([1, 2, 3, 4, 5, 6, 7, 8], [], f)
}
+
+// a |> from_list |> map(_, f) |> to_list == a |> list.map(_, f)
+pub fn map_test() {
+ let test = fn(subject, f) {
+ subject
+ |> iterator.from_list
+ |> iterator.map(_, f)
+ |> iterator.to_list
+ |> expect.equal(_, list.map(subject, f))
+ }
+
+ let f = fn(e) { e * 2 }
+ test([], f)
+ test([1], f)
+ test([1, 2, 3], f)
+ test([1, 2, 3, 4, 5, 6, 7, 8], f)
+}