Add a test for core::str::from_cstr_len
This commit is contained in:
parent
6408d54c13
commit
70b04a14d1
@ -1979,6 +1979,14 @@ mod tests {
|
||||
assert (c == "AAAAAAA");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_cstr_len() unsafe {
|
||||
let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
|
||||
let b = vec::to_ptr(a);
|
||||
let c = from_cstr_len(b, 3u);
|
||||
assert (c == "AAA");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_as_buf() unsafe {
|
||||
let a = "Abcdefg";
|
||||
|
Loading…
x
Reference in New Issue
Block a user