Skip to content

Commit

Permalink
Add a test for core::str::from_cstr_len
Browse files Browse the repository at this point in the history
  • Loading branch information
uasi committed Feb 12, 2012
1 parent 6408d54 commit 70b04a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libcore/str.rs
Expand Up @@ -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";
Expand Down

0 comments on commit 70b04a1

Please sign in to comment.