From d76ebf19e3ec0280d3d9e5d1b77eed281778610d Mon Sep 17 00:00:00 2001 From: Guillaume Petiot Date: Thu, 7 Mar 2024 18:01:16 +0000 Subject: [PATCH] Redefine List.equal --- test/lib/test_contributions.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/lib/test_contributions.ml b/test/lib/test_contributions.ml index b91326f..1c760e7 100644 --- a/test/lib/test_contributions.ml +++ b/test/lib/test_contributions.ml @@ -66,9 +66,16 @@ module Testable = struct (Repo_map.pp (Format.pp_print_list Item.pp)) x.activity + (* [List.equal] requires OCaml >= 4.12 *) + let list_equal eq lx ly = + try + List.iter2 (fun x y -> if not (eq x y) then failwith "not equal") lx ly; + true + with _ -> false + let eq (x : t) (y : t) = String.equal x.username y.username - && Repo_map.eq (List.equal Item.eq) x.activity y.activity + && Repo_map.eq (list_equal Item.eq) x.activity y.activity let testable = Alcotest.testable pp eq end