@@ -161,6 +161,42 @@ requires an extra flag which is documented below.
161
161
* Animations are ** disabled** during tests, so setting the speed will have no
162
162
impact on anything. You should not write unit tests or doctests that depend
163
163
on animations.
164
+ * To measure test code coverage, several steps:
165
+ * Before anything, we use [ Tarpaulin] ( https://github.com/xd009642/tarpaulin )
166
+ in order to run the coverage. As of writing this, Tarpaulin only supports the
167
+ ** Linux x86_64** platform, so make sure to be using a compatible setup.
168
+ * First, install Tarpaulin using ` cargo install cargo-tarpaulin --version 0.13.3 ` .
169
+ * We are currently using not the most recent version of Tarpaulin because
170
+ one of our indirect dependencies itself uses a Tarpaulin configuration
171
+ attribute refactored in ` 0.13.4 ` , which causes a compilation error. So
172
+ until this indirect dependency gets to a newer version either by a direct
173
+ dependency or us requiring it, this is how it will be.
174
+ * This will very probably change in the future, in that case, it will be
175
+ properly documented here and one will be able to omit the ` --version 0.13.3 `
176
+ in order to download and install the latest version.
177
+ * Then run ` cargo +nightly tarpaulin --features "test unstable" --run-types Tests Doctests `
178
+ * ` --features "test unstable" ` is required for the same reasons as the tests:
179
+ the documentation tests use the ` test ` feature in order to get configured
180
+ automatically and many tests require ` unstable ` features.
181
+ * ` +nightly ` has to be given because Tarpaulin runs documentation tests only
182
+ on the nightly channel. If you don't have it installed yet, please refer to
183
+ the [ rustup documentation] ( https://rust-lang.github.io/rustup/concepts/channels.html )
184
+ in order to get it on your machine.
185
+
186
+ * ` --run-types Tests Doctests ` is needed because Tarpaulin only measures
187
+ coverage from the calls generated by the public tests by default, so we
188
+ have to explicitely specify documentation tests as well: a lot of
189
+ documentation tests have been implemented, so taking them into account
190
+ drastically changes the overall score obtained.
191
+ * Tarpaulin has a lot of other useful functionalities, so be sure to check
192
+ them out by listing its available options using ` cargo tarpaulin --help ` and
193
+ reading [ their README] ( https://github.com/xd009642/tarpaulin#tarpaulin ) ,
194
+ especially for the ` --out ` option which lets you export results to many
195
+ different formats.
196
+ * When implementing new features or completing some for this project, try to
197
+ also write as many tests as possible in order to keep your features in
198
+ check and let everyone have a greater trust in them. The higher the score,
199
+ usually the better!
164
200
* To generate the project's documentation, run ` cargo doc `
165
201
* To open the generated documentation, run ` cargo doc --open `
166
202
* When writing documentation, it is often easier to have the documentation
0 commit comments