Description
What
Currently, only a few functions are tested, which may lead to uncaught breaking changes in the future.
With the issue, I hope to motivate the need of creating more tests to extend the actual coverage.
How to
Testing library
For testing individual functions, you can create tests either inside tests modules, e.g., with mod tests
(or test_my_name
):
languagetool-rust/src/lib/server.rs
Lines 562 to 594 in 6cf960a
or inside function's documentation, e.g, with examples:
languagetool-rust/src/lib/server.rs
Lines 24 to 47 in 6cf960a
for testing multiple functions at the same time, i.e., the integration of multiple functions, please write tests in the tests folder.
Testing the CLI
Testing the CLI is the same as for the library, but everything is currently defined the src/bin.rs
. So you should test build_cli()
with different arguments and check that it correctly fails or succeed for some configurations. See clap::Command::try_get_matches_from
.