From 18bba0dd980aecc715ce1610e8e8a3d3407c7351 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Van Date: Wed, 7 Oct 2020 16:04:47 +0200 Subject: [PATCH 1/4] Testing: Better comments in testing files of src/lib_error_monad --- .../test/test_recursive_registration.ml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib_error_monad/test/test_recursive_registration.ml b/src/lib_error_monad/test/test_recursive_registration.ml index fc5bcfabc19a..ceedb0a2c2ce 100644 --- a/src/lib_error_monad/test/test_recursive_registration.ml +++ b/src/lib_error_monad/test/test_recursive_registration.ml @@ -23,6 +23,13 @@ (* *) (*****************************************************************************) +(* Testing + ------- + Component: Error Monad + Invocation: dune build @src/lib_error_monad/runtest + Subject: On explicit management of errors. +*) + module Make () = struct open TzCore @@ -53,7 +60,7 @@ module Make () = struct let b_par_nil = Data_encoding.Binary.to_bytes_exn error_encoding parsha let () = - assert (parsha = Data_encoding.Binary.of_bytes_exn error_encoding b_par_nil) + assert (parsha = (Data_encoding.Binary.of_bytes_exn error_encoding b_par_nil)) let (_ : string) = Format.asprintf "%a" pp parsha @@ -146,6 +153,11 @@ module Make () = struct let main () = () end +(* Test. + Asserts that roundtrips [of/to_bytes_exn] preserve the error + datatypes [ParSha []], [ParSha [ParSha []]], [ParSha [A; A]], as + well as deep recursion. + *) let test_register_rec () = let module M = Make () in M.main () -- GitLab From d5d30309acbe8fe26c4e1f05e34b5424cf9902c1 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Van Date: Tue, 27 Oct 2020 14:18:44 +0100 Subject: [PATCH 2/4] Testing: Compliance with ocamldoc --- .../test/test_recursive_registration.ml | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/lib_error_monad/test/test_recursive_registration.ml b/src/lib_error_monad/test/test_recursive_registration.ml index ceedb0a2c2ce..b90e02908bf2 100644 --- a/src/lib_error_monad/test/test_recursive_registration.ml +++ b/src/lib_error_monad/test/test_recursive_registration.ml @@ -23,11 +23,11 @@ (* *) (*****************************************************************************) -(* Testing - ------- - Component: Error Monad - Invocation: dune build @src/lib_error_monad/runtest - Subject: On explicit management of errors. +(** Testing + ------- + Component: Error Monad + Invocation: dune build @src/lib_error_monad/runtest + Subject: On explicit management of errors. *) module Make () = struct @@ -60,7 +60,7 @@ module Make () = struct let b_par_nil = Data_encoding.Binary.to_bytes_exn error_encoding parsha let () = - assert (parsha = (Data_encoding.Binary.of_bytes_exn error_encoding b_par_nil)) + assert (parsha = Data_encoding.Binary.of_bytes_exn error_encoding b_par_nil) let (_ : string) = Format.asprintf "%a" pp parsha @@ -153,11 +153,10 @@ module Make () = struct let main () = () end -(* Test. - Asserts that roundtrips [of/to_bytes_exn] preserve the error - datatypes [ParSha []], [ParSha [ParSha []]], [ParSha [A; A]], as - well as deep recursion. - *) +(** Asserts that roundtrips [of/to_bytes_exn] preserve the error + datatypes [ParSha []], [ParSha [ParSha []]], [ParSha [A; A]], as + well as deep recursion. +*) let test_register_rec () = let module M = Make () in M.main () -- GitLab From 9a0449a238555520e4d0be31fcf37e72b52c2fb5 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Van Date: Mon, 2 Nov 2020 14:09:32 +0000 Subject: [PATCH 3/4] Apply 1 suggestion(s) to 1 file(s) --- src/lib_error_monad/test/test_recursive_registration.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib_error_monad/test/test_recursive_registration.ml b/src/lib_error_monad/test/test_recursive_registration.ml index b90e02908bf2..b9e7474e9a89 100644 --- a/src/lib_error_monad/test/test_recursive_registration.ml +++ b/src/lib_error_monad/test/test_recursive_registration.ml @@ -27,7 +27,8 @@ ------- Component: Error Monad Invocation: dune build @src/lib_error_monad/runtest - Subject: On explicit management of errors. + Subject: On the registration and serialization of shallow, deep + and recursive errors. *) module Make () = struct -- GitLab From 96eb929e88e2d6aeccd8b0b1fe0b6e14f0265585 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Van Date: Mon, 2 Nov 2020 16:21:25 +0100 Subject: [PATCH 4/4] Testing: Amended according to @arvidnl's review. --- src/lib_error_monad/test/test_recursive_registration.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib_error_monad/test/test_recursive_registration.ml b/src/lib_error_monad/test/test_recursive_registration.ml index b9e7474e9a89..4b5e3e1e51a2 100644 --- a/src/lib_error_monad/test/test_recursive_registration.ml +++ b/src/lib_error_monad/test/test_recursive_registration.ml @@ -63,6 +63,9 @@ module Make () = struct let () = assert (parsha = Data_encoding.Binary.of_bytes_exn error_encoding b_par_nil) + (** Checks that the pretty-printer doesn't fail. That pretty-printer + relies on at least one global reference and has an assert false + in its body. *) let (_ : string) = Format.asprintf "%a" pp parsha let parsha_cube = ParSha [ParSha []] @@ -155,7 +158,7 @@ module Make () = struct end (** Asserts that roundtrips [of/to_bytes_exn] preserve the error - datatypes [ParSha []], [ParSha [ParSha []]], [ParSha [A; A]], as + values [ParSha []], [ParSha [ParSha []]], [ParSha [A; A]], as well as deep recursion. *) let test_register_rec () = -- GitLab