Test code
An unwrap in a test is the assertion. A MockClock under #[cfg(test)]
is exactly the injectable the testing article asks for. Test code answers to
a different standard, and rabot knows where it is.
What counts as test code
- any item or impl item under
#[cfg(test)], or acfgthat mentionstest(#[cfg(any(test, feature = "test-utils"))]) #[test],#[tokio::test],#[rstest]and#[bench]functions- whole files under
tests/,benches/orexamples/
What is relaxed there
The domain rules: panic-in-production, swallowed-error, dropped-error-context,
untyped-error, boolean-validation, ambient-time, ambient-randomness,
ambient-config,
primitive-soup, primitive-field, stringly-typed-field,
bypassable-constructor, free-function, vague-type-name,
orphan-module, oversized-impl, too-many-parameters,
sectioned-function.
What is not
Sorting, the comment rules, mock-usage, ignored-test and
sleep-in-tests. A test file is still code, and the last three are about
tests.
Tuning it
[tests]
relax = [] # hold tests to the full standard
relax = ["panic-in-production"] # relax only this one