@@ -7,7 +7,15 @@ let cw_print_success () = print_endline "\n<PASSED::>Test passed"
7
7
let cw_print_failure err = print_endline (" \n <FAILED::>" ^ _esc_lf err)
8
8
9
9
let cw_print_error err = print_endline (" \n <ERROR::>" ^ _esc_lf err)
10
-
10
+
11
+ let cw_print_it label = print_endline (" \n <IT::>" ^ label)
12
+
13
+ let cw_print_describe label = print_endline (" \n <DESCRIBE::>" ^ label)
14
+
15
+ let cw_print_completed t =
16
+ Printf. sprintf " \n <COMPLETEDIN::>%.2f" (t *. 1000.0 )
17
+ |> print_endline
18
+
11
19
let cw_print_result = function
12
20
| RSuccess _ -> cw_print_success ()
13
21
| RFailure (_ , err ) -> cw_print_failure err
@@ -19,20 +27,27 @@ let cw_print_test_event = function
19
27
| EStart _ | EEnd _ -> ()
20
28
21
29
let dispatch_test_case label test_case =
22
- print_endline (" \n <IT::>" ^ label);
30
+ cw_print_it label;
31
+ let start = Unix. gettimeofday () in
23
32
perform_test cw_print_test_event test_case |> ignore;
24
- print_endline " \n <COMPLETEDIN::> "
33
+ cw_print_completed ( Unix. gettimeofday () -. start)
25
34
26
35
let rec dispatch_labeled_test label test =
27
36
match test with
28
- | TestLabel (nested_label , nested_test ) -> dispatch_labeled_test nested_label nested_test
37
+ | TestLabel (nested_label , nested_test ) -> begin
38
+ cw_print_describe label;
39
+ let start = Unix. gettimeofday () in
40
+ dispatch_labeled_test nested_label nested_test;
41
+ cw_print_completed (Unix. gettimeofday () -. start)
42
+ end
29
43
| TestCase _ -> dispatch_test_case label test
30
44
| TestList tests -> begin
31
- print_endline (" \n <DESCRIBE::>" ^ label);
45
+ cw_print_describe label;
46
+ let start = Unix. gettimeofday () in
32
47
run_tests tests;
33
- print_endline " \n <COMPLETEDIN::> " ;
48
+ cw_print_completed ( Unix. gettimeofday () -. start)
34
49
end
35
-
50
+
36
51
and run_test = function
37
52
| TestList tests -> " " > ::: tests |> run_test
38
53
| TestCase func -> " " > :: func |> run_test
0 commit comments