diff options
author | Chuck Daniels <cjdaniels4@gmail.com> | 2023-03-23 12:59:31 -0400 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-03-23 19:48:27 +0000 |
commit | b2b07ef0612cc549508b757826d8d143d9587119 (patch) | |
tree | c45ae71d2cc53f50afb65360f7d357db65c1d2f1 /test | |
parent | 35b5049025d6b09fa5979840b340ba63d5c948d9 (diff) | |
download | gleam_stdlib-b2b07ef0612cc549508b757826d8d143d9587119.tar.gz gleam_stdlib-b2b07ef0612cc549508b757826d8d143d9587119.zip |
Make iterator.any/all TCO eligible in JavaScript
Fixes #427
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/iterator_test.gleam | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/gleam/iterator_test.gleam b/test/gleam/iterator_test.gleam index 9c98c9d..81c790e 100644 --- a/test/gleam/iterator_test.gleam +++ b/test/gleam/iterator_test.gleam @@ -406,6 +406,12 @@ pub fn any_test() { iterator.from_list([1, 3, 5, 7, 9]) |> iterator.any(satisfying: fn(n) { n % 2 == 0 }) |> should.be_false + + // TCO test + iterator.repeat(1) + |> iterator.take(1_000_000) + |> iterator.any(satisfying: fn(n) { n % 2 == 0 }) + |> should.be_false } pub fn all_test() { @@ -420,6 +426,12 @@ pub fn all_test() { iterator.from_list([2, 4, 5, 8]) |> iterator.all(satisfying: fn(n) { n % 2 == 0 }) |> should.be_false + + // TCO test + iterator.repeat(0) + |> iterator.take(1_000_000) + |> iterator.all(satisfying: fn(n) { n % 2 == 0 }) + |> should.be_true } pub fn group_test() { |