aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/list_test.gleam14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index c4305f5..321f5a4 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -306,6 +306,20 @@ pub fn concat_test() {
// }
}
+pub fn flatten_test() {
+ list.flatten([])
+ |> should.equal([])
+
+ list.flatten([[]])
+ |> should.equal([])
+
+ list.flatten([[], [], []])
+ |> should.equal([])
+
+ list.flatten([[1, 2], [], [3, 4]])
+ |> 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])