aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/list_test.gleam20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index dfc9693..3bd463a 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -180,15 +180,27 @@ pub fn index_fold_test() {
pub fn try_fold_test() {
[1, 2, 3]
|> list.try_fold(
- [],
+ 0,
+ fn(i, acc) {
+ case i < 4 {
+ True -> Ok(acc + i)
+ False -> Error(Nil)
+ }
+ },
+ )
+ |> should.equal(Ok(6))
+
+ [1, 2, 3]
+ |> list.try_fold(
+ 0,
fn(i, acc) {
case i < 3 {
- True -> Ok([i, ..acc])
- False -> Error(acc)
+ True -> Ok(acc + i)
+ False -> Error(Nil)
}
},
)
- |> should.equal([2, 1])
+ |> should.equal(Error(Nil))
}
pub fn find_map_test() {