-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Alcotest.suite
function to make writing tests easier
#393
base: main
Are you sure you want to change the base?
Conversation
Example usage: | ||
|
||
{[ | ||
let () = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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;
end Wouldn'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? |
Fixes #126.