use std::io::{Cursor, Read};
use std::str;
use system_interface::io::Peek;
#[test]
fn test_peek() {
let mut input = Cursor::new("hello".to_string());
let mut buf = vec![0_u8; 20];
assert_eq!(Peek::peek(&mut input, &mut buf).unwrap(), 5);
assert_eq!(str::from_utf8(&buf[..5]).unwrap(), "hello");
assert_eq!(input.position(), 0);
assert_eq!(Peek::peek(&mut input, &mut buf).unwrap(), 5);
assert_eq!(str::from_utf8(&buf[..5]).unwrap(), "hello");
assert_eq!(input.position(), 0);
assert_eq!(Read::read(&mut input, &mut buf).unwrap(), 5);
assert_eq!(str::from_utf8(&buf[..5]).unwrap(), "hello");
assert_eq!(input.position(), 5);
}