Refactor tests

This commit is contained in:
Yota Toyama 2025-04-06 20:08:10 -07:00
parent 063393d176
commit eb085c5464

View File

@ -66,8 +66,7 @@ impl<const N: usize> CString<N> {
/// ///
/// ```rust /// ```rust
/// use heapless::CString; /// use heapless::CString;
/// let mut cstr: CString<5> = /// let mut cstr = unsafe { CString::<5>::from_bytes_with_nul_unchecked(b"cstr\0").unwrap() };
/// unsafe { CString::from_bytes_with_nul_unchecked(b"cstr\0").unwrap() };
/// ///
/// assert_eq!(cstr.to_str(), Ok("cstr")); /// assert_eq!(cstr.to_str(), Ok("cstr"));
/// ``` /// ```
@ -247,7 +246,7 @@ impl<const N: usize> CString<N> {
/// ```rust /// ```rust
/// use heapless::CString; /// use heapless::CString;
/// ///
/// let mut cstr: CString<10> = CString::new(); /// let mut cstr = CString::<10>::new();
/// cstr.push_bytes(b"heapless").unwrap(); /// cstr.push_bytes(b"heapless").unwrap();
/// ///
/// assert_eq!(unsafe { cstr.as_str_unchecked() }, "heapless",); /// assert_eq!(unsafe { cstr.as_str_unchecked() }, "heapless",);