Add a test for core::str::from_cstr_len

This commit is contained in:
Tomoki Aonuma 2012-02-12 13:28:54 +09:00
parent 6408d54c13
commit 70b04a14d1

View file

@ -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";