diff options
Diffstat (limited to 'Documentation/rust/testing.rst')
-rw-r--r-- | Documentation/rust/testing.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/rust/testing.rst b/Documentation/rust/testing.rst index 180b886e0f1e..f692494f7b74 100644 --- a/Documentation/rust/testing.rst +++ b/Documentation/rust/testing.rst @@ -123,6 +123,13 @@ A current limitation is that KUnit does not support assertions in other tasks. Thus, we presently simply print an error to the kernel log if an assertion actually failed. Additionally, doctests are not run for nonpublic functions. +Since these tests are examples, i.e. they are part of the documentation, they +should generally be written like "real code". Thus, for example, instead of +using ``unwrap()`` or ``expect()``, use the ``?`` operator. For more background, +please see: + + https://rust.docs.kernel.org/kernel/error/type.Result.html#error-codes-in-c-and-rust + The ``#[test]`` tests --------------------- |