rust: str: add `CStr` unit tests
authorMilan Landaverde <milan@mdaverde.com>
Thu, 10 Nov 2022 16:41:30 +0000 (17:41 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 4 Dec 2022 00:59:15 +0000 (01:59 +0100)
commit985f1f09bf5bf8cbcb43e58a2320de2a5054be4c
tree4424cfdc5f3a17ca64dff5945bda893c930c7ddc
parentc07e67bd2daf99de923b6fd927ab8c18e0f57b05
rust: str: add `CStr` unit tests

Add unit tests for `CStr::from_bytes_with_nul()` and
`CStr::from_bytes_with_nul_unchecked()`.

These serve as an example of the first unit tests for Rust code
(i.e. different from documentation tests).

Signed-off-by: Milan Landaverde <milan@mdaverde.com>
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/str.rs