diff options
author | Marcin Puc <marcin.e.puc@gmail.com> | 2021-03-12 17:46:58 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2021-03-20 13:35:54 +0000 |
commit | 5072b0e961add30e0a03df5e9b8d1d6f455f7085 (patch) | |
tree | 7003d5644bfdabc609137b84172fc50308724338 /test | |
parent | 5f663745bbf4d74dabbcdb91f5398a29890af2cf (diff) | |
download | gleam_stdlib-5072b0e961add30e0a03df5e9b8d1d6f455f7085.tar.gz gleam_stdlib-5072b0e961add30e0a03df5e9b8d1d6f455f7085.zip |
Add iterator.chunk_by
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/iterator_test.gleam | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/gleam/iterator_test.gleam b/test/gleam/iterator_test.gleam index 9250f9c..2c62ff4 100644 --- a/test/gleam/iterator_test.gleam +++ b/test/gleam/iterator_test.gleam @@ -298,3 +298,10 @@ pub fn zip_test() { |> iterator.to_list |> should.equal([tuple("a", 20), tuple("b", 21), tuple("c", 22)]) } + +pub fn chunk_by_test() { + iterator.from_list([1, 2, 2, 3, 4, 4, 6, 7, 7]) + |> iterator.chunk_by(fn(n) { n % 2 }) + |> iterator.to_list + |> should.equal([[1], [2, 2], [3], [4, 4, 6], [7, 7]]) +} |