aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Porto <s@porto5.com>2021-05-08 06:28:31 +1000
committerGitHub <noreply@github.com>2021-05-07 20:28:31 +0000
commit32b56eb7cd04bdd47a548b021602a018bdf782c6 (patch)
treedd55c7e7371e2938bec5eb4c613f04585122ffb1 /test
parent7b10d02d88af84560855337e45c755686a396943 (diff)
downloadgleam_stdlib-32b56eb7cd04bdd47a548b021602a018bdf782c6.tar.gz
gleam_stdlib-32b56eb7cd04bdd47a548b021602a018bdf782c6.zip
Add list.flat_map (#202)
Diffstat (limited to 'test')
-rw-r--r--test/gleam/list_test.gleam5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index 1e90583..c7e2a34 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -165,6 +165,11 @@ pub fn flatten_test() {
|> should.equal([1, 2, 3, 4])
}
+pub fn flat_map_test() {
+ list.flat_map([1, 10, 20], fn(x) { [x, x + 1] })
+ |> should.equal([1, 2, 10, 11, 20, 21])
+}
+
pub fn fold_test() {
[1, 2, 3]
|> list.fold([], fn(x, acc) { [x, ..acc] })