Fix SmallCStr conversion from CStr

This commit is contained in:
Eric Huss
2024-02-14 18:40:53 -08:00
parent ee9c7c940c
commit 217e5e484d
2 changed files with 9 additions and 1 deletions

View File

@@ -43,3 +43,11 @@ fn long() {
fn internal_nul() {
let _ = SmallCStr::new("abcd\0def");
}
#[test]
fn from_cstr() {
let c = c"foo";
let s: SmallCStr = c.into();
assert_eq!(s.len_with_nul(), 4);
assert_eq!(s.as_c_str(), c"foo");
}