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 2aa1b3e..3277e47 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -177,6 +177,20 @@ pub fn index_fold_test() {
|> should.equal([tuple(2, "c"), tuple(1, "b"), tuple(0, "a")])
}
+pub fn fold_until_test() {
+ [1, 2, 3, 4]
+ |> list.fold_until(
+ from: 0,
+ with: fn(n, acc) {
+ case n < 4 {
+ True -> list.Continue(acc + n)
+ False -> list.Stop(acc)
+ }
+ },
+ )
+ |> should.equal(6)
+}
+
pub fn try_fold_test() {
[1, 2, 3]
|> list.try_fold(