Our testing methodology has test documentation as a first class object in the documentation output. Specifically, it defines the specification that is tested by each behavioural test.
Running cargo doc
on a project with suitably documented tests doesn't yield much in the way of documentation derived from the test doc strings and I can't see any obvious way of making it include the test doc strings in the output.
An example module would be as follows:
/// This function does some important stuff
pub fn working_fn() -> bool {
true
}
#[cfg(test)]
mod tests {
//! This is some important set of tests
//!
use super::*;
/// The function should work
#[test]
fn it_works() {
assert!(working_fn());
}
}
I get documentation output for the public working_fn
, but nothing for the tests
module. I appreciate that an additional complication is that tests are private and ideally I'd be able to document private tests without also documenting other private objects.