Add new Alcotest.suite function to make writing tests easier#393
Add new Alcotest.suite function to make writing tests easier#393yawaramin wants to merge 8 commits intomirage:mainfrom
Alcotest.suite function to make writing tests easier#393Conversation
| Example usage: | ||
|
|
||
| {[ | ||
| let () = |
There was a problem hiding this comment.
The ocamlformat settings don't like the formatting of this example. IMHO, the format settings are incorrect :-)
And update Lwt suite example.
|
Many thanks for your patch - two remarks:
|
|
Hi @samoht thanks for the review. Regarding your points,
let string_case_lower_case () =
Alcotest.(check string) "same string" "hello!" (To_test.lowercase "hELLO!")
let string_case_capitalization () =
Alcotest.(check string) "same string" "World." (To_test.capitalize "world.")
let string_concat_string_mashing () =
Alcotest.(check string) "same string" "foobar" (To_test.str_concat ["foo"; "bar"])
let list_concat_list_mashing () =
Alcotest.(check (list int)) "same lists" [1; 2; 3] (To_test.list_concat [1] [2; 3])
let () =
Alcotest.suite "Utils" begin fun group ->
group "string-case" begin fun case ->
case "Lower case" string_case_lower_case;
case "Capitalization" string_case_capitalization;
end;
group "string-concat" begin fun case ->
case "String mashing" string_concat_string_mashing;
end;
group "list-concat" begin fun case ->
case ~speed:`Slow "List mashing" list_concat_list_mashing;
end;
endWouldn't this bring us back to the current situation where the test implementations and registrations are separate and can get out of sync? E.g. if I don't have an empty EDIT: also this means we need to decide on names for the test case functions, and they have to be reasonable and meaningful names. We can't just do e.g. |
|
Love this! Can we expect this to go in? |
|
I'm looking at this again - I think there are 2 things in that patch that needs to be reviewed separately
Do you think that makes sense? |
|
In particular, I'd like to make sure we take the feedback from #294 into account |
Fixes #126.