From a62cba0c87a590697a5efc24cd1c8693999e519a Mon Sep 17 00:00:00 2001 From: Arvid Jakobsson Date: Mon, 27 Mar 2023 15:34:10 +0200 Subject: [PATCH] Alcotezt: split tests --- tezt/lib_alcotezt/alcotest.ml | 25 ++++++++++++------------- tezt/lib_alcotezt/alcotest_lwt.ml | 23 ++++++++++------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/tezt/lib_alcotezt/alcotest.ml b/tezt/lib_alcotezt/alcotest.ml index 8ed4b1991853..f78238226aff 100644 --- a/tezt/lib_alcotezt/alcotest.ml +++ b/tezt/lib_alcotezt/alcotest.ml @@ -40,20 +40,19 @@ type 'a test = string * 'a test_case list let run ~__FILE__ library_name tests = tests |> List.iter @@ fun (test_name, test_cases) -> - Test.register - ~__FILE__ - ~title:(library_name ^ ": " ^ test_name) - ~tags:["alcotezt"] - @@ fun () -> - (test_cases + test_cases |> List.iter @@ fun (test_case_name, speed_level, body) -> - match speed_level with - | `Slow when Cli.get_bool ~default:false "quick" -> - Log.info "Skipped test: %s" test_case_name - | `Slow | `Quick -> - Log.info "Test: %s" test_case_name ; - body ()) ; - Base.unit + let tags = + "alcotezt" + :: (match speed_level with `Quick -> ["quick"] | `Slow -> []) + in + Test.register + ~__FILE__ + ~title:(library_name ^ ": " ^ test_name ^ " (" ^ test_case_name ^ ")") + ~tags + @@ fun () -> + body () ; + Base.unit type 'a testable = (module Tezt_core.Check.EQUALABLE with type t = 'a) diff --git a/tezt/lib_alcotezt/alcotest_lwt.ml b/tezt/lib_alcotezt/alcotest_lwt.ml index 0b91a01a2535..62ccf6f5a3c4 100644 --- a/tezt/lib_alcotezt/alcotest_lwt.ml +++ b/tezt/lib_alcotezt/alcotest_lwt.ml @@ -50,18 +50,15 @@ type 'a test = string * 'a test_case list let run ~__FILE__ library_name tests = (tests |> List.iter @@ fun (test_name, test_cases) -> - Test.register - ~__FILE__ - ~title:(library_name ^ ": " ^ test_name) - ~tags:["alcotezt"] - @@ fun () -> test_cases - |> Lwt_list.iter_s @@ fun (test_case_name, speed_level, body) -> - match speed_level with - | `Slow when Cli.get_bool ~default:false "quick" -> - Log.info "Skipped test: %s" test_case_name ; - unit - | `Slow | `Quick -> - Log.info "Test: %s" test_case_name ; - body ()) ; + |> List.iter @@ fun (test_case_name, speed_level, body) -> + let tags = + "alcotezt" + :: (match speed_level with `Quick -> ["quick"] | `Slow -> []) + in + Test.register + ~__FILE__ + ~title:(library_name ^ ": " ^ test_name ^ " (" ^ test_case_name ^ ")") + ~tags + @@ fun () -> body ()) ; unit -- GitLab