diff options
author | Marcin Puc <5671049+tranzystorek-io@users.noreply.github.com> | 2021-03-10 10:47:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 09:47:22 +0000 |
commit | 1643c557b5e7e5fcbaf70a689a9b9d8f74e3ee83 (patch) | |
tree | 261ff4f666a9fa439c7ad17e5cbf9c24a87f15f2 /test | |
parent | 1f693fae46e607d6ba811f7d01a9b903f0762420 (diff) | |
download | gleam_stdlib-1643c557b5e7e5fcbaf70a689a9b9d8f74e3ee83.tar.gz gleam_stdlib-1643c557b5e7e5fcbaf70a689a9b9d8f74e3ee83.zip |
Add iterator.scan (#173)
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 ffe57e4..f1ee880 100644 --- a/test/gleam/iterator_test.gleam +++ b/test/gleam/iterator_test.gleam @@ -265,6 +265,13 @@ pub fn iterate_test() { |> should.equal([1, 3, 9, 27, 81]) } +pub fn scan_test() { + iterator.from_list([1, 2, 3, 4, 5]) + |> iterator.scan(from: 0, with: fn(el, acc) { acc + el }) + |> iterator.to_list + |> should.equal([1, 3, 6, 10, 15]) +} + pub fn zip_test() { iterator.from_list(["a", "b", "c"]) |> iterator.zip(iterator.range(20, 30)) |